A small utility to create React Contexts that allow components to subscribe to specific keys (slices) of the context value to avoid unnecessary re-renders.
Inspired by the need to optimize context updates by only re-rendering components that depend on the changed slice of the context value.
npm install react-sliced-context
# or
yarn add react-sliced-contextFor the example project in this repository, run
yarnin theexamplefolder and thenyarn start.
Check the example package.
This repository includes unit tests. From the repo root run:
yarn testor from the example folder:
cd example
yarn
yarn startContributions are welcome. Please open issues for bugs or feature requests and create PRs for fixes.
MIT