#Using Nextjs 13 Route Middleware in Client Side

13 messages · Page 1 of 1 (latest)

zealous belfry
#

I am trying to use NextJS 13 Route Middleware to check for Metamask authenticated Users using Wagmi Package. But since wagmi works on client side. I am unable to achieve that in middleware. I tried using "use client" on the top of the middleware.ts. But it doesn't seem to work

wooden starBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

      🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in <id:customize>

      ✅ You can mark a message as the answer for your post with `Right click -> Apps -> Mark Solution`
      (if you don't see the option, try refreshing Discord with Ctrl + R)
hallow garnet
#

I guess you have to wrap your app using a wrapper with use client and check that in there

zealous belfry
#

everything will become client component then

#

🥲

manic thunder
#

that's how web3 works. middleware is supposed to run on Edge Runtime, which is not related to ReactJS, just a light weight Node.js with no cold start time.

topaz tendon
astral notch
zealous belfry
#

thanks people

#

i'll try these

manic thunder
#

or NFT token

zealous belfry
#

would have been good if we could've used routes middleware as client component 🥲

manic thunder
#

react hooks are easier