DEV Community

Discussion on: Gatsby vs Next.JS - What, Why and When?

Collapse
 
fazlulkarimweb profile image
Md Fazlul Karim • Edited

Next can now both of the things. I started using Next.js. Never looked back.

In Nextjs
export const getStaticProps = async () => { // getStaticProps for SSG, getServerSideProps for SSR
const data = await fetchData();

return {
props: data,
};
};

IN GATSBY
export const query = graphql
query {
site {
siteMetadata {
title
}
}
}

Rest of the codes are almost same.