0.0.4 • Published 5 years ago

statojs v0.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

STATO

This package will help you to handle a state in the whole application. This will help you in case you need to share data in the entire application.

SET AN STATE

You can use the function setState to set a new state. This will receive the key that you want to use and its value. You can overwrite an existing state by calling this function with an repeated key.

setState('name', 'jose')

GET THE STATE

You can use the function getState to get the whole state of the application

getState()

GET THE STATE BY KEY

You can get an specific state by using the getStateByKey function.

getStateByKey('name')

CREATE A REACT LISTENER

You can create a React Listener by using the React Component State. This will make the component to render each time the stato change.

const [value, setValue] = useState(0)
createReactListener(setValue, key)

MAKE THE STATE GLOBAL

At the beginning the state would be private, and you would be able to see it only using functions like getState or getStateByDate, by doing this an global constant would be created with the state with the key statojs1992

makeStateGlobal()

You can see an example of its use in this commit

https://github.com/jososav/reactapp/commit/590b0504c72ac84a0d54bc05f450c3a80ec72b78

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1-beta1

5 years ago

0.0.1

5 years ago