# useSwitchNetwork

URL: https://docs.blux.cc/react/hooks/use-switch-network

Change the active network in your React app using the Blux SDK.

The `useSwitchNetwork` hook returns a `switchNetwork` function for changing the currently active network.

<Callout type="info">
  Switching the active network affects components like the profile modal and hooks such as `useBalance`, `useAccount`, and `useTransactions` when no explicit `network` parameter is provided to them.
</Callout>

## Import
```tsx
```

## Usage
```tsx

const Comp = () => {
  const { switchNetwork } = useSwitchNetwork();

  const changeNetwork = () => {
    switchNetwork(networks.mainnet);
  };

  return (
    <div>
      <button onClick={changeNetwork}>Change network to mainnet</button>
    </div>
  );
};
```

## Return Type

### `switchNetwork`
`(network: string) => void`

Call with a network value from the `networks` object to update the active network across your app.