For AI agents: the complete documentation index is at llms.txt. Remove the trailing slash from a page URL and append .md to read its Markdown version. For the docs home, use index.md.

State

Reflex state connects your components to application data. Store values in an rx.State class, pass its vars to component props, and update those values from event handlers.

Start with state and events

  • State overview: define application state and connect it to your interface.
  • Base vars: store typed values that components can display.
  • Computed vars: derive values from existing state.
  • Events: update state in response to user interactions.

Build reusable interactive components

Use component state when each instance needs its own data. Use conditional rendering and rendering iterables to make your interface respond to state changes.