9. Render props
A component with a render prop takes a function that returns a React element and calls it instead of
implementing its own render logic.
16. recompose
Recompose is a React utility belt for function components and higher-order components
https://codesandbox.io/s/yqy23w3nmj
17. A Note from the Author (acdlite, Oct 25 2018):
Hi! I created Recompose about three years ago. About a year after that, I joined the React team. Today, we announced a
proposal for Hooks. Hooks solves all the problems I attempted to address with Recompose three years ago, and more on top of
that. I will be discontinuing active maintenance of this package (excluding perhaps bugfixes or patches for compatibility with
future React releases), and recommending that people use Hooks instead. Your existing code with Recompose will still work, just
don't expect any new features. Thank you so, so much to @wuct and @istarkov for their heroic work maintaining Recompose
over the last few years.
Read more discussion about this decision here.
18.
19.
20. What kind of problems do hooks solve?
Reusing logic
Huge components
Confusing classes
Wrapper hell
21. Hooks
Hooks are an upcoming feature that lets you use state and other React features without writing a class
28. useEffect()
It’s executed after all renders
if returns a function, that function is called in the
unmount time
can receive an array as a second param, and
when with that, the effect is just called after the
first render if the values passed changed. Also, if
passed an empty array, the effect will be called
just one time.
29. useEffect()
can be used to replace componentDidMount,
componentDidUpdate and
componentWillUnMount
if you are working with visual DOM
manipulations, use useLayoutEffect instead,
useLayoutEffect runs synchronously before the
paint process of the browser