File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " @poly-state/react" ,
3- "version" : " 1.2.2 " ,
3+ "version" : " 1.2.3 " ,
44 "description" : " React bindings for React" ,
55 "main" : " dist/index.js" ,
66 "repository" : " https://github.com/poly-state/react.git" ,
Original file line number Diff line number Diff line change 1+ import { ReturnStoreType , StateConstraint } from '@poly-state/poly-state' ;
2+ import { useEffect , useState } from 'react' ;
3+
4+ export const useStore = < T extends StateConstraint > ( store : ReturnStoreType < T > ) => {
5+ const [ state , setState ] = useState ( store . getState ( ) ) ;
6+ useEffect ( ( ) => store . subscribe ( setState ) , [ store ] ) ;
7+ return state ;
8+ } ;
Original file line number Diff line number Diff line change 99 "allowSyntheticDefaultImports" : true ,
1010 "strict" : true ,
1111 "forceConsistentCasingInFileNames" : true ,
12- "module" : " ES6 " ,
12+ "module" : " commonjs " ,
1313 "moduleResolution" : " node" ,
1414 "isolatedModules" : true ,
1515 "jsx" : " react-jsx" ,
You can’t perform that action at this time.
0 commit comments