V
V
vovashaplin2020-08-13 12:14:21
React
vovashaplin, 2020-08-13 12:14:21

How to work with react context in NextJS?

I'm switching to NextJS. Previously worked with context in create-react-app. In the same place, he fetched the data and dispatched them and inserted everything into initialState. But in NextJs, the problem is that you need to fetch in the component itself, namely in getServerSideProps. Thus, I do not understand whether I need to insert the fetched data into the context for each component and then work with them. Do you have at least some examples of working with NextJs and React Context?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question