State allows us to create interactive apps that can respond to user input.
It defines the variables that can change over time, and the functions that can modify them.
Each user who opens your app has a unique ID and their own copy of the state.
This means that each user can interact with the app and modify the state
independently of other users.
Because Reflex internally creates a new instance of the state for each user, your code should
never directly initialize a state class.
Try opening an app in multiple tabs to see how the state changes independently.
All user state is stored on the server, and all event handlers are executed on
the server. Reflex uses websockets to send events to the server, and to send
state updates back to the client.
Similar to backend vars, any method defined in a State class that begins with an
underscore _ is considered a helper method. Such methods are not usable as
event triggers, but may be called from other event handler methods within the
state.
Functionality that should only be available on the backend, such as an
authenticated action, should use helper methods to ensure it is not accidentally
or maliciously triggered by the client.