🔐 Hinten is a small, scoped react state managment system using hooks and a simple api.
Index
Features
- < 2kB gzip, gets checked thanks to bundlesize
- Scoping of state and actions
- Simple small API
- Usable for big states
- Only select what you need
- Full typescript support
Installation
npm install hinten
or
yarn add hinten
Usage
Store creation
// useStore.js; const useStore = ; ;
Store usage
// A.jsximport React from 'react';import useStore from './useStore'; ...props const state dispatch = ; return <div > <button ="button" = > Test me! </button> statecount statesideMenuisOpen </div> ;
Scoped store usage
// B.jsximport React from 'react';import useStore from './useStore'; ...props // If you don't need the entire store you can simple select a part of it // This component will only get rerender if something changes in it's selected part const state dispatch = ; return <div > <button ="button" = > Test me! </button> stateisExpanded </div> ;