React Hooks
Add state management and SDK interactions using Para’s React hooks
Overview
Para’s React hooks provide an intuitive way to manage wallet state, handle transactions, and interact with the Para SDK. This guide assumes you’ve already set up the Para Modal in your application following one of our framework integration guides.
Setting Up the Provider
To use Para’s React hooks, wrap your application with ParaProvider
. This provider gives your components access to
Para’s hooks and state management.
Provider Configuration
Using the Hooks
Here’s an example component using Para’s React hooks to handle wallet connection and message signing:
Available Hooks
Query Hooks
Hooks to access current the current Para instance account and wallet state. These hooks use the
React Query useQuery
hook and return the
same structure as the React Query hooks.
Mutation Hooks
Hooks for performing actions and state changes in the Para instance. These hooks use the
React Query useMutation
hook and
return the same structure as the React Query hooks (see the note below). NOTE Our hooks return mutation functions
named specifically for their mutation action. For example,useCreateUser
returns both createUserAsync
and
createUser
rather than the mutateAsync
and mutate
functions that React Query returns, these functions are
identical to their React Query counterparts.
Utility Hooks
Hooks for retrieving and modifying application state. These hooks DO NOT incorporate or follow and React Query patterns.
Advanced Usage
Using Para with EVM Providers
The ParaProvider
can work with our External Wallet Connectors to provide wallet connection. An example using our Para
EVM Provider is shown below:
For more details on using external wallet connectors visit any of the external wallet integration guides: