#How to fetch from backend in client component (for logo, not for sensitive info)

9 messages ยท Page 1 of 1 (latest)

sage slate
#

Hello everyone,

I have a Logo component which combines an image and some text with some styling to use as the logo of the website.
This Logo component will be used in client components too, so I can't use async/await to fetch from the backend (to get the url of the image and the text).

Is there a way I can get around this, or maybe some more proper way to preload the data I need for the Logo component, without having to then pass props to every component from my layout to the Logo?

charred dirgeBOT
#

๐Ÿ”Ž 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)

somber storm
sage slate
sage slate
#

oh ok, thanks!
I was assuming that context was going to be better because client-side fetching c an be dangerous, but im just fetching an image and some text so it makes sense in this case ๐Ÿ˜›
Thanks for the help! ^^

somber storm
sage slate
#

yup, on it! I ended up using swr because I've already got some familiarity with it from a previous project, and it did the trick! Thanks man!

charred dirgeBOT
#
โœ… Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer