PrivyProvider
component and wrap your app with it.
The PrivyProvider
must wrap any component or page that will use the Privy React SDK, and it is generally recommended to render it as close to the root of your application as possible.
PrivyProvider
component accepts the following props:
config
object, look under React > Advanced for guides like
customizing appearance for our UI components and
configuring networks.PrivyProvider
is first rendered on your page, the Privy SDK will initialize some state about the current user. This might include checking if the user has a wallet connected, refreshing expired auth tokens, fetching up-to-date user data, and more.
It’s important to wait until the PrivyProvider
has finished initializing before you consume Privy’s state and interfaces, to ensure that the state you consume is accurate and not stale.
To determine whether the Privy SDK has fully initialized on your page, check the ready
Boolean returned by the usePrivy
hook. When ready
is true, Privy has completed initialization, and your app can consume Privy’s state and interfaces.
useWallets
hook to wait for wallets to complete loading.