llms.txt
@mysten/sui v2.0 and a new dApp Kit are here! Check out the migration guide
Mysten Labs SDKs
ReactHooks

useCurrentNetwork

React hook to get the currently selected Sui network in dApp Kit.

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