react-sliced-context
v1.0.1
Published
Tiny React Context with key-based subscriptions to prevent unnecessary re-renders.
Maintainers
Readme
react-sliced-context
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.
Install
npm install react-sliced-context
# or
yarn add react-sliced-contextFor the example project in this repository, run
yarnin theexamplefolder and thenyarn start.
Quick Example
Check the example package.
Testing
This repository includes unit tests. From the repo root run:
yarn testor from the example folder:
cd example
yarn
yarn startContributing
Contributions are welcome. Please open issues for bugs or feature requests and create PRs for fixes.
License
MIT
