4 ms·
Where is the typical place to put initial fetches? I've been setting empty state and then calling a method at the end of a constructor which ultimately results
by FLUX-YOU 9y ago
Where is the typical place to put initial fetches? I've been setting empty state and then calling a method at the end of a constructor which ultimately results in a promise that calls setState with the data.
But I would never do something like that in, say, the constructor of a WPF/UWP windows app as those have "Loaded" or "Loading" events of some kind (which is parallel to componentDidMount).
- ihsw2 9y ago`componentDidMount`, which is after a React component has been rendered. This contradicts the parent commenter directly but I'm fine with that. The React lifecycle has `componentDidMount` for doing stuff (at most once) after rendering.
- always_good 9y agoI don't understand what you're saying. Once the component mounts, then it can be unmounted. The upstream comment is talking about when you have a promise that is still running after unmount.