nonstoppants
TTCTheo's Typesafe Cult
•Created by nonstoppants on 6/8/2023 in #questions
Data fetching in NextJs 13.4+
I have a question about this statement
- In this new model, we recommend fetching data directly in the component that needs it, even if you're requesting the same data in multiple components, rather than passing the data between components as props.
I thought the server component paradigm was fetch in a server component and pass the data to the client component leaves. As a simple example, say you were populating a drop down list from an api call. I assumed the server component would request the data and pass it into whatever client component is going to create the interactive list. Is that the wrong way to think about it?
Are fetch requests only cached if implemented inside of a server component? I've read the nextjs docs and I feel they make assumptions about some of the underlying concepts.
Small thing, are components outside of the app folder default server components as well or do they have to be within the app directory?
10 replies