-1

I'm tryin to fetch data from my api but fast refresh causing error when I try to know why I found that next js has a bug req.params work only for once because fast refresh feature in next js do you know a solution or any other way get id from url other than req.params in express js Thank you for your time😇😇😇

express js code)

the code in next js

2
  • Before asking question, it may be beneficial to take the tour and read the various pages in the help center, particularly How to Ask or Why should I not upload images of code/data/errors?. Commented Mar 14, 2023 at 9:38
  • Can you edit your question and paste your code as code blocks instead of images. What is the error you're getting? Could you add that to the question as well? Commented Mar 14, 2023 at 9:39

1 Answer 1

0

A common issue with the router is that the query param is undefined on the first render. You can use router.isReady or check that the id is not undefined before sending the api call

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.