INNER CODE UNIT · JavaScript
getStaticProps
imranhsayed/nextjs-headless-wordpress · frontend/pages/blog/index.js:21
export async function getStaticProps() {
const { data, errors } = await client.query( {
query: GET_POSTS,
variables: {
uri: '/blog/',
perPage: PER_PAGE_FIRST,
offset: null,
},
} );
const defaultProps = {
props: {
data: data || {}
},
/**
* Revalidate means that if a new request comes to server, then every 1 sec it will check
* if the data is changed, if it is changed then it will update the
* static file inside .next folder with the new data, so that any 'SUBSEQUENT' requests should have updated data.