jedisdb
redis like key-value state management solution for React
Reactive. Redux alternative. Simple and powerful global state management system, accessible through every component.
Features ?
- Reactive
- State accessable through every components
- no reducer, no action needed
- small bundle size
Basic Usage
npm i jedisdb
yarn add jedisdb
happy hacking
Demo:
Counter Codesandbox.
Shopping Cart Codesandbox.
useJedis
returns a react hook so it can only used in react functional components,
selectState
has no side effects, it can be used anywhere,
createState
creates jedis object without any side effects.
demo: Accessing value in JS funciton Codesandbox.
Best Practice
use createState
to create jedis object and then use useJedis
to access it, is considered best practice
demo: Codesandbox