skip to Main Content

I have a NEXTJS 13 with Pages directory project. I want to request to our graphql server in every route change. And want to make it from server. But can i do it ? And even if I do it can I put this datas to my Redux store ? Thanks for responses!

2

Answers


  1. I suggest using the "router.events" of NextJS since there are plenty of router change events for you to choose. Their document can be found here and it is pretty straight forward. Server calls and redux interactions should be made easily inside the useEffect function.

    Login or Signup to reply.
  2. Middleware is run upon every request and could be used to implement additional logic to call a GraphQL server.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search