WalletUiClusterContextProvider
The provider for the WalletUiClusterContext.
The WalletUiClusterContextProvider
is a React context provider that manages the state of the selected Solana cluster. It also handles saving and retrieving the selected cluster from local storage.
This component is used internally by the main WalletUi
provider and you probably won't need to use it directly.
Props
Name | Type | Description |
---|---|---|
clusters | SolanaCluster[] | An array of all available cluster objects. |
render | (props: WalletUiClusterContextValue) => ReactNode | The function to render. |
storage | StorageCluster | The storage to use for persisting the cluster. |
Example
This example shows how you could use the provider.
import { WalletUiClusterContextProvider } from '@wallet-ui/react';
function MyApp({ children }) {
return (
<WalletUiClusterContextProvider
clusters={[]}
render={props => (
<div>
<p>Current Cluster: {props.cluster.label}</p>
{children}
</div>
)}
/>
);
}