[Next js] Query params not working

Hi! I have two issue with my some dynamic pages on my personal website.

  1. If you click on one service, it redirects you to the correct page, but you can see the text “Errore! Per favore, torna indietro e riapri la pagina.”
    I put this message if no description is fetched by query params, but if you check the console you can see that the correct description is there, so it should regularluìy appear on the page

  2. Since i’m using query params to pass data to the dynamic generated pages, refreshing them make them to lose this data. Is there a way to preserve it?

Since the code is in a private repository, i can give access if someone can help

Thanks in advance

Might be related?

2 maybe?

I’ve tried this approach

const Details = () => {
  const [title,setTitle]=useState("")
  const router = useRouter();
  useEffect(() => {
    if (router.isReady) {
      // Code using query
      // this will set the state before component is mounted
  }, [router.isReady]);

return (
      <div className="single__page">
        <div className="single__header">

but it doesn’t seem to work because it the Link i’m using the “as” to remove all the params from the url

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.