deprecated
this module is deprecated please use
- react-rest-state
- react-global-hook recommended for usehooks
reststate
state managment for react apps
install
npm i reststate --save
use
;...;...statehello="Hello world"...console
inits
/** * initial new state just for example * this is a stack with maximum length 4 * and return any time last item of stack */;
connect
; Component { console; this; }; { return <View> <Text>statestate1</Text> <Button title="add" onPress= { statestate1 += 1; } /> </View> ; } app "state1";//refresh component any time state changed
connectInline
; Component { superprops; thisunsubscribe = ; } { console; this; }; { return <View> <Text>statestate1</Text> <Button title="add" onPress= { statestate1 += 1; } /> </View> ; } { this; };//runs stateChange when state update recommended when you dont want render component
reset
;/** * you can get defualt value */console/** * reset state to defualt value */;
set
;/** * set few state value */;
forceUpdate
;/** * update or run all connected to this state */;
other utility
;/** * copy variable1 to variable2 * recommended for Object and array or other type */var variable2 = ;