ChainProvider

A React context provider component that supplies Chain-related data to its child components.

This component serves as a wrapper around the ChainProviderContext.Provider and passes the provided chain data down to all of its child components through the context API.

Example

Basic usage

import { ChainProvider, ChainIcon, ChainName } from "thirdweb/react";
import { ethereum } from "thirdweb/chains";
<ChainProvider chain={ethereum}>
<ChainIcon />
<ChainName />
</ChainProvider>;

Usage with defineChain

import { defineChain } from "thirdweb/chains"l
import { ChainProvider, ChainName } from "thirdweb/react";
const chainId = someNumber;
<ChainProvider chain={defineChain(chainId)}>
<ChainName />
</ChainProvider>
function ChainProvider(
props: PropsWithChildren<ChainProviderProps>,
): Element;

Parameters

Type

let props: PropsWithChildren<ChainProviderProps>;

Returns

let returnType: Element;