IM_SANG_TAE is a global state management library for JavaScript applications. It's designed to provide a simple and intuitive API for managing state in an efficient and scalable way.
- Supports both atom and selector for managing state.
- Easy to integrate with any JavaScript application.
- Efficient updates and minimal re-renders.
- Support for tracking dependencies between selectors.
# using npm
npm install im-sang-tae
# using yarn
yarn add im-sang-tae
To start using IM_SANG_TAE in your project, you need to create atoms or selectors with an initial state:
import { getDefaultStore } from "im-sang-tae";
// get default store
const defaultStore = getDefaultStore();
// create atom
const myAtom = defaultStore.createAtom({
key: "myAtom",
initialState: 0,
});
// create selector
const mySelector = defaultStore.createAtom({
key: "mySelector",
get: ({get}) => {
return get(myAtom) + 1;
}
})
You can get the current state and set a new state using the atomState method from the state manager:
import { defaultStateManger } from "im-sang-tae";
const [getMyAtom, setMyAtom] = defaultManager.atomState(myAtom);
const [getMySelector, setMySelector] = defaultManager.atomState(mySelector);
defaultManager.subscribe(myAtom, () => {
console.log(getMyAtom());
});
defaultManager.subscribe(mySelector, () => {
console.log(getMySelector());
});
This project is licensed under the MIT License.