> For AI agents: the complete documentation index is at [llms.txt](https://reflex.dev/docs/llms.txt). Markdown versions are available by appending `.md` or sending `Accept: text/markdown`.

# Statemanager

`reflex.istate.manager.StateManager`

A class to manage many client states.

## Methods

| Signature | Description |
| --- | --- |
| `create(cls)` | Create a new state manager. |
| `get_state(self, token: Union[reflex.istate.manager.token.StateToken[~TOKEN_TYPE], str]) -> ~TOKEN_TYPE` | Get the state for a token. |
| `set_state(self, token: Union[reflex.istate.manager.token.StateToken[~TOKEN_TYPE], str], state: ~TOKEN_TYPE, **context: Unpack[reflex.istate.manager.StateModificationContext])` | Set the state for a token. |
| `modify_state(self, token: Union[reflex.istate.manager.token.StateToken[~TOKEN_TYPE], str], **context: Unpack[reflex.istate.manager.StateModificationContext]) -> collections.abc.AsyncIterator[~TOKEN_TYPE]` | Modify the state for a token while holding exclusive lock. |
| `modify_state_with_links(self, token: Union[reflex.istate.manager.token.StateToken[~TOKEN_TYPE], str], previous_dirty_vars: dict[str, set[str]] \| None = None, **context: Unpack[reflex.istate.manager.StateModificationContext]) -> collections.abc.AsyncIterator[~TOKEN_TYPE]` | Modify the state for a token, including linked substates, while holding exclusive lock. |
| `close(self)` | Close the state manager. |
