Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda