Skip to content

Stuck on reconnecting when changing routes #402

Answered by L-TheG
L-TheG asked this question in Q&A
Discussion options

You must be logged in to vote

Hi thanks for your reply!

I am using Next.js.
For the connection page I am pretty much using the code from the Next.js example from this repo.
I am only using the MetaMask connector for now.
In the first component where I initially connect the Wallet, the code looks something like this:

function Dashboard(){
    const {isConnected} = useConnect();
    const {data} = useAccount();

    if (!isConnected) {
        return <ConnectScreen />;
    }
    if (data.address !== requiredAddress && isConnected) {
        return <DashboardElements/>
    }
}

This works perfectly well.
The when I click in the NavBar of my App, the route changes from '/dashboard' to '/usecase/usecase1'.
This component w…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@tmm
Comment options

@L-TheG
Comment options

@tmm
Comment options

@L-TheG
Comment options

Answer selected by L-TheG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants