INNER CODE UNIT · JavaScript
getStaticProps
imranhsayed/nextjs-headless-wordpress · frontend/pages/index.js:15
export async function getStaticProps( context ) {
const { data, errors } = await client.query( {
query: GET_PAGE,
variables: {
uri: '/',
},
} );
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.
*/