INNER CODE UNIT · JavaScript

getStaticProps

imranhsayed/nextjs-headless-wordpress · frontend/pages/news/index.js:18

export async function getStaticProps() {
	const { data, errors } = await client.query( {
		query: GET_NEWS,
		variables: {
			uri: '/news/',
			first: PER_PAGE_FIRST,
			after: 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.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…