#Data fetching from param values

1 messages · Page 1 of 1 (latest)

narrow ravine
#

So i have a special use case where I need to fetch data based on a subtype dynamic param, but i need to access this value in other components as well, where params not available, and also this fetch returns a tenantId that i need to use in a lot of component.

My question is that what is my best option here?
Currently i am doing a check for domains, etc and set a a cookie with that subtype, and whenever i need to fetch data with the subtype param I just fetch it from the cookie value, not from the params, and also I set the tenantId, and use that as well from the cookies.

Is it okay to do so, or I am completely wrong on this? If so, what would be the way to go?

drifting cairnBOT
#

🔎 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)

outer cloud
narrow ravine
outer cloud
#

If there is 5 components, I recommend useContext

#

Or you can get in the client component using new URL(), it has some properties with the help of what you can get pathname

outer cloud
#

@narrow ravine resolved?

narrow ravine
outer cloud
#

You can just pass it down, if its server components, and just use props. to get it

narrow ravine
#

you mean just get the passed down data from the props right? no need to fetch it again?

outer cloud
#

you can pass it down to props