Closed abidRahim closed 3 years ago
Yes, I actually wrote up a proposal about what I want to do. I'd be inclined to still use with PureComponent for StickyTree (which is the same as react-window - see https://github.com/bvaughn/react-window/blob/master/src/createListComponent.js) due to performance reasons, but proposed exposing a Context and a hook for accessing the API of StickyTree.
Thoughts welcome.
Imo Context API won't be a wise choice for performance reasons, unless Redux is used for the same purpose. On using useContext() and useReducer() hooks for one of my projects, i realized that changing any state in the Context reflects a DOM update on all the other components where Global state has been used, irrespective of the usage of newly updated state in those components.
I'm aware of that issue, but don't think that would affect performance for this usecase, but the experience I gain with hooks, the more I think PureComponent is probably best in this case. Were you hoping that there would be a set of hooks exposed as part of the API, or just thinking that the library itself would benefit from hook usage?
I was hoping, the library itself would benefit from the usage of hooks. Let's say for future updates and code readability purpose.
Converted to TypeScript, but kept the usage or PureComponent due to performance reasons. It's still compatible to use with hooks - see examples
Would be more than glad to contribute.