Why can this client component fetch data?
Answered
Blue Mockingbird posted this in #help-forum
Blue MockingbirdOP
So i have the following code that is working perfectly, but shouldn't it not be viable to fetch data from a client component like that?
Answered by Giant panda
As part of handlers it has always worked. What do you think interaction with API looked like in the past? There HAS to be a way. What you are confused about is that within server components you can directly fetch without moving the logic to effects or handlers.
2 Replies
Giant panda
As part of handlers it has always worked. What do you think interaction with API looked like in the past? There HAS to be a way. What you are confused about is that within server components you can directly fetch without moving the logic to effects or handlers.
Answer
Blue MockingbirdOP
Oh got it, that makes so much sense thanks. I'm new to frontend development, so still learning.