3 ms·
This is a good list. React's core APIs are pretty small and straightforward, but there's a _lot_ of different patterns you can build using those APIs. If anyo
by acemarke 9y ago
This is a good list. React's core APIs are pretty small and straightforward, but there's a _lot_ of different patterns you can build using those APIs.
If anyone's interested, my React/Redux links list [0] points to a variety of other useful articles for various React techniques, such as the "React Component Patterns" [1] and "React Component Composition" [2] categories. Those cover topics like use of `props.children`, context, the "container/presentational" pattern, interacting with non-React code, component lifecycle methods, Higher-Order Components, the "function-as-child / render props" pattern, and more.
There's also some more good overviews of useful React patterns at [3], [4], and [5] .
[0] https://github.com/markerikson/react-redux-links https://github.com/markerikson/react-redux-links
[1] https://github.com/markerikson/react-redux-links/blob/master/react-component-patterns.md https://github.com/markerikson/react-redux-links/blob/master...
[2] https://github.com/markerikson/react-redux-links/blob/master/react-component-composition.md https://github.com/markerikson/react-redux-links/blob/master...
[3] http://reactpatterns.com/ http://reactpatterns.com/
[4] https://hackernoon.com/react-composition-patterns-from-the-ground-up-8401aaad93d7 https://hackernoon.com/react-composition-patterns-from-the-g...
[5] https://blog.pixelingene.com/2017/09/the-common-patterns-of-react/ https://blog.pixelingene.com/2017/09/the-common-patterns-of-...
- leetbulb 9y ago+1 on the render prop style HOC. Wish I had the time to write an example, but a good one is React Router's withRouter HOC [0]. I've used this a ton and it works extremely well. [0] https://github.com/ReactTraining/react-router/blob/master/packages/react-router/modules/withRouter.js https://github.com/ReactTraining/react-router/blob/master/pa...