DEV Community

Discussion on: Using React Context for state management in Next.js

Collapse
 
cassidoo profile image
Cassidy Williams

You can do that in any state variables you store in the Context! In your example, I'd probably call your API in a useEffect and then set a state variable in that, and then make sure that state variable is passed into Context. Here's an example of that from the Jamstack Explorers GitHub repo: github.com/netlify/explorers/blob/...