How to detect connect correct network or not #1740
Unanswered
vanthao03596
asked this question in
Q&A
Replies: 1 comment
-
import { useSwitchNetwork,useNetwork } from 'wagmi'
const {chain} = useNetwork();
const {switchNetwork} = useSwitchNetwork();
useEffect(()=>{
if(chain !== 1){
switchNetwork(1);
}
},[chain]); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In my production app, i want to ask user switch to mainnet network if user connect wrong network.
Anyone can help me to detect connect wrong network ?
Beta Was this translation helpful? Give feedback.
All reactions