curious about the explicit true and false in one of their code examples. any good reason for that?
// dispatching an action based on state change
componentWillUpdate(nextProps, nextState) {
if (nextState.open == true && this.state.open == false) {
this.props.onWillOpen();
}
}
This is great. Everyone says react is easy and can be learnt in a day, and the docs/tutorials definitely make it feel that way. But then when you actually go to use it there are a bazillion funky patterns using new-ish es6 patterns and operators, and by the time you’ve implemented them they are outdated and no longer best practice because apparently there’s a better way now. So this list is useful.
I equate learning any new domain as going into a zoo. You look at each animal on its own and you can learn about difference between animals. You can complete it reasonably in a weekend. But going into wild wild forest is entirely another. (If you are interested, I wrote about it here: https://jjude.com/are-you-learning-a-new-domain-visit-its-zo...)
I learned React reasonably quick. But when I started writing production application, I got into so many cases which were not covered in introductory materials. I found answers to some of these cases via google; I had to find answers to many others by trial and error.
That is why people sharing these type of patterns helps. We all become wiser before getting into wild forest.
React has an amazingly small surface area and really is quite easy to learn, compared to pre-existing libraries with similar goals.
What makes React seem so daunting is the rest of the ecosystem: Webpack, Babel, Redux/MobX/MST/Apollo/Relay, React Router, etc.
The most common misconception is that you have to understand all of those technologies to get started. Luckily tools like Create React App have started to change that.
[0]: https://developmentarc.gitbooks.io/react-indepth/content/