React API

The React API is a set of hooks and components that allow you to interact with the server and the Stackpress toolkit.

flash()

A flash message is a temporary message that is displayed to the user after the next page load. It is typically used to inform the user of a successful action or to provide feedback on an operation.
Copy
In the example above, once the button is clicked, a flash message will be set and shown on the next page load.

notify()

Shows a notification message to the user. This requires the component to be wrapped around the app.
Copy
The method takes a type and a message as arguments. The type can be one of the following.

useConfig()

Returns the from the server props.
Copy
You can set the data in the server props in a route like this.
Copy

useConfirm()

Used to show a confirmation modal before executing an action.
Copy

useLanguage()

Used to tag text for translation.
Copy

useModal()

Used to show a modal. This requires the component to be wrapped around the app.
Copy

useRequest()

Returns the from the server props.
Copy

useResponse()

Returns the from the server props.
Copy

useServer()

Returns the , ,, and from the server props.
Copy

useSession()

Returns the from the server props.
Copy

useTheme()

Used to toggle the theme. This requires the component to be wrapped around the app.
Copy

ModalProvider

Manages the modal state and provides the hook to the app.
Copy

NotifyProvider

Manages the notification state and provides the and methods to the app.
Copy

ServerProvider

Manages the server state and provides the , , , , and hooks to the app.
Copy

StackpressProvider

A wrapper for the , , , and components.
Copy

ThemeProvider

Manages the theme state and provides the hook to the app.
Copy

Translate

Inline component used to tag text for translation.
Copy