# State
Allows you to get a type that represents the state of a model.
State<
Model extends object = {}
>
# Example
import { State } from 'easy-peasy';
import { StoreModel } from './index';
type StoreState = State<StoreModel>;
Typically this would only be useful when using the useStoreState
hook.
import { useStoreState, State } from 'easy-peasy';
import { StoreModel } from './store';
function MyComponent() {
const todos = useStoreState(
(state: State<StoreModel>) => state.todos.items
);
}
That being said, we recommend you use the createTypedHooks API instead.