Wallet UI LogoWallet UI

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

NameTypeDescription
clustersSolanaCluster[]An array of all available cluster objects.
render(props: WalletUiClusterContextValue) => ReactNodeThe function to render.
storageStorageClusterThe 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>
            )}
        />
    );
}

On this page