# API Documentation
## Common API (Angular/React/Svelte/Vue)
### createSubState
export default function createSubState(
initialState: T & AllowedInitialStateProperties
): SubState
Creates a sub state object from initial state object.
This function adds a readonly \_\_isSubState\_\_ property to the initial state object.
Initial state may not contain key __isSubState\__, if it contains, an error will be thrown.
Initial state must be an object with following property value types allowed: number, boolean, string, undefined, null,
Function, object, Array, Map, Set, WeakMap, WeakSet
### combineSelectors
combineSelectors(
selectorsObject1: Selectors,
...
selectorsObject2: Selectors
): Selectors & ... Selectors;
combines objects of selectors to a single object containing all selectors.
It also checks for duplicate selector keys and throws an error if a duplicate key is found.
### createStore
createStore(
initialState: T,
selectors: Selectors
): Store
creates a store containing initialState and selectors
### Store::getState
class Store {
getState(): ReactiveState
}
gets state from the store
### Store::getSelectors
class Store {
getSelectors(): ComputedSelectors
}
gets selectors from the store
### Store::getStateAndSelectors
class Store {
getStateAndSelectors(): [ReactiveState, ComputedSelectors]
}
gets state and selectors from the store
## React specific API
### Store::useState
useState(subStates: Array): void
makes React functional component to use given sub-state(s) and/or state from state getter(s) and makes changes to given sub-state(s) or state getters to update the view.
**NOTE!** If you call only getState() and forget to call useState(), your view won't be reactive and does not update.
### Store::useSelectors
useSelectors(selectors: ComputedRef[]): void
makes React functional component to use given selectors and makes changes to given selectors to update the view.
**NOTE!** If you call only getSelectors() and forget to call useSelectors(), your view won't be reactive and does not update.
### Store::useStateAndSelectors
useStateAndSelectors(subStates: Array, selectors: ComputedRef[]): void
makes React functional component to use given sub-state(s), and state getter(s) and selectors and makes changes to given sub-state(s), state getter(s)
and selectors to update the view.
**NOTE!** If you call only getStateAndSelectors() and forget to call useStateAndSelectors(), your view won't be reactive and does not update.