Better HN
topnewbestaskshowjobs
Log inSign up

jordrake

2 karma · joined Sep 13, 2018 (8y ago) · 1 submissions

Submissions

comment 8y ago · link · parent

This is a nice library but state management libraries that rely on components in the render tree (function as a prop or children) mean you cannot access those properties in the immediate component's react lifecycle methods.

Instead you have to (sometimes arbitrarily) have a child component which takes in those properties. This child can then reference those properties in it's react lifecycle methods.

Fortunately this is a pretty simple problem to solve, you could introduce a higher order component which takes in your component and selectors much like redux. Infact, it seems the author beat me to it: https://twitter.com/aweary/status/1011478641320980480