getServerSideProps = fetch data on every request

PHOTO EMBED

Mon Oct 17 2022 08:18:36 GMT+0000 (Coordinated Universal Time)

Saved by @Jeremicah #react.js

export const getServerSideProps = async (context) => {
  const res = await fetch(
    `https://jsonplaceholder.typicode.com/posts/${context.params.id}`
  );
  const article = await res.json();

  return {
    props: {
      article,
    },
  };
};
content_copyCOPY