by SebastianKra · 6y ago · 0 comments
Yes, you _can_ do fetching and rendering in a single function, but that doesn't mean you should.
I will even go a step further and say that, in React, there is no data-part. React is nothing but a really powerful templating system.
(EDIT: It's actually more nuanced, but this is how I approach it.)
The data-layer is usually handled by another library like Redux, Apollo Client or React-Query/useSWR.