Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!