#hello is there a preferred way or can I

1 messages · Page 1 of 1 (latest)

naive aurora
desert islandBOT
#

Hi @naive aurora. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

naive aurora
#

for app dir route handlers

desert islandBOT
#

Sorry @naive aurora, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:

Perhaps try again in 15mins?

placid igloo
#

If you're using route handlers, functionally the only difference is using params or searchparams. In the pages folder, they're both params.

#

Is that route being clicked on by a user, or are you just using it as an api route?

naive aurora
#

thanks @placid igloo , it's a route clicked by a user from their email inbox

placid igloo
#

I was just thinking it might be better handled on the page level, params are also available with a hook in client components.

naive aurora
#

hmm, interesting. I'll look into this, thanks tons!

naive aurora
#

I realized I was stuck in the separated client / server mindset from when I was starting to learn MERN last year. I keep forgetting I can access backend resources in the server components. Thanks!

placid igloo
#

Next + React 18 really unlocks a whole new arch pattern, so it really makes you consider where when and how you do things that were previously only able handled in one place. This is a good read as well which explains more of what next is doing under the hood in context.

https://vercel.com/blog/framework-defined-infrastructure

Framework defined infrastructure means programmatic framework understanding for automatic infrastructure provisioning—an evolution from Infrastructure as Code (IaC).