react-context-consumer-hoc
react-context-consumer-hoc copied to clipboard
[feature] simplify codebase to expose internal API
Checklist
- [x] I have made a material change to the repo (functionality, testing, spelling, grammar)
- [x] I have read the [Contribution Guide] and my PR follows them.
- [x] I updated my branch with the master branch.
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] I have added necessary documentation about the functionality in the appropriate .md file
- [x] I have added inline documentation to the code I modified
Short description of what this PR does:
- The main reason for this update is to expose createContextConsumerChain to allow using this library not only as HOC but also to render inside a component.
- The codebase is modularized and simplified
- More tests added for each new module
Work in progress label added.
I have to do some heavy profiling before this PR is merged to determine if the new implementation is actually better or worse.
The reason is that I refactored the consumeContext
to be able to remove all the React.fowardRef
leaving only 1.
That said, all tests pass, i.e. the behavior is exactly the same, the only difference is that there is an extra function that is created when the consumer chain executes and that could impact rendering time even if the rest of the forwardRef
were removed.
After a year, I still think this is a valid idea.
This PR is something I would like to revisit now that I'm working on version 3.