Hacker News new | past | comments | ask | show | jobs | submit login
React in Patterns (gitbooks.io)
170 points by nikhildaga on May 13, 2018 | hide | past | favorite | 10 comments



There is another awesome gitbook, React in Depth[0].

[0]: https://developmentarc.gitbooks.io/react-indepth/content/


That was fantastic! Any other great guides like that or a repository of them?


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(); } }


Do you mean instead of using !nextState.open and `this.state.open`? Reads a little easier to write out the booleans in my opinion.


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.


I think the issue here is that React is a rather thin layer atop of JS.

On the one hand, this makes it really flexible and it can keep up with the new things that happen in JS-land.

On the other hand it's always bleeding edge.


React in it's stated goal IS quite easy, but I agree, to become a master, you should learn a few patterns quickly.

I don't feel like react's docs are misleading - like anything - mastery requires investment.


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.


People who think they have learned a framework in a day probably haven't learned too much.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: