4 ms·
Stay with React, don't go with the newest shiniest JS framework. React has a 3rd party solution for nearly everything so you can piece all these well-developed
by bluedevil2k 6y ago
Stay with React, don't go with the newest shiniest JS framework. React has a 3rd party solution for nearly everything so you can piece all these well-developed and well-tested modules together to make your app.
Others may suggest using Hooks right from the start, so I'll act as the counterpoint. Starting with Class components is easier to understand and less is happening magically. Almost everything can be accomplished using only 3 lifecycle methods - constructor, render() and componentDidMount. Once you're comfortable with how that all comes together, start to pick up Hooks
- richeyryan 6y agoIf you are doing asynchronous data fetching in your components, only using those three lifecycle methods will inevitably lead to bugs when your props or state update but your asynchronous call doesn't fire again because it was in componentDidMount. You need to use componentDidUpdate to trigger the call again when props or state update. Alternatively useEffect with the dependency array properly filled won't allow a stale state like that to occur.