4 ms·
One thing I can’t figure out in hooks vs recompose is how to use them and avoid props drilling or even just basic wiring. One of the most glorious things about
by linkmotif 8y ago
One thing I can’t figure out in hooks vs recompose is how to use them and avoid props drilling or even just basic wiring. One of the most glorious things about recompose is that the props are drilled/wired for you automatically. This turns out to be huge for me. I had so much tedious props drilling code that just went away with recompose. Anyone have any insight?
- jakelazaroff 8y agoUse the Context API introduced in 16.3: https://reactjs.org/docs/context.html https://reactjs.org/docs/context.html This is the same API that or anything that "teleports" state around your tree uses internally.
- linkmotif 8y agoFun approach! But I don’t think that’s it? Just not the same kind of zero-effort awesomeness right? Also uses the context API for something it’s not intended for.
- jakelazaroff 8y agoI'm not sure what you mean — the context API is specifically for moving data around the component tree without prop drilling. What are you talking about with regard to recompose?
- linkmotif 8y agoI guess I just mean wiring. Recompose eliminates the need to do any wiring at all. You compose up your component, and then you have access to all those props without having wired them! The last thing I want to do is get the context API involved.