Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
Nextjs: Does getStaticPaths and getStaticProps with useEffect effect SEO?

I'm using getStaticPaths and getStaticProps to retrive data from backend and than using useeffect to set these data to the state (data).

Why am i doing this? I'm doing this because of load more button, so i have to load more content when the button is clicked.

But my seo doesnt depend on the state(data).

So my question is does seo(header) is rendered on server and than other components that use data from the state?

export const getStaticPaths = async () => {
  const data = await get();
  if (data.status === 'fail' || !data.data.data) {
    return {
      paths: [],
      fallback: true,
    };
  }
  const paths = data.data.data.map((category: any) => {
    return {
      params: { categoria: category.attributes.name },
    };
  });
  return {
    paths: paths,
    fallback: true,
  };
};

export const getStaticProps = async (context: any) => {
  const id = context.params.categoria.split('-').join(' ');
  const dataCateriesExist = await getGenericAxios();
  if (
    dataCateriesExist.status === 'fail' ||
    dataCateriesExist.data.data.length === 0
  ) {
    return { notFound: true };
  }
  const data = await get();
  const dataVideo = await get(....)
  return { props: { news: data, video: dataVideo }, revalidate: 60 };
};

how i use useEffect:

 useEffect(() => {
    if (!router.isFallback) {
      setNext(props.news?.data?.links?.next?.href || '');
      setData(props.news?.data?.data || []);
      setIncluded(props.news?.data?.included || []);
      setNextVideo(props.video?.data?.links?.next?.href || '');
      setDataVideo(props.video?.data?.data || []);
      setIncludedVideo(props.video?.data?.included || []);
    }
  }, [router.isFallback, props]); 

and i have by seo component that does not use data from the state, its only text

Also without useEffect if i try to do something like

const [data, setData] = useState(props.news?.data?.data || []);

and than the path is changed with another category i see the same data as the before page

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda