Mysten Labs SDKs
ReactHooks

useCurrentNetwork

The useCurrentNetwork hook provides access to the currently selected network.

All dApp Kit hooks must be used within components that are descendants of DAppKitProvider. Using them outside will result in an error.

Usage

import { useCurrentNetwork } from '@mysten/dapp-kit-react';

export function MyComponent() {
	const network = useCurrentNetwork();

	return (
		<div>
			<p>Current network: {network}</p>
		</div>
	);
}

Return Value

string;

On this page