Pagination
Used to display a pagination for next/previous results. Pagination will appear if the user clicked on a PaginatedLink.
Props
searchData = {object}
result = {object}
Example with code:
import { absoluteUrl } from '@helpers/utils';
import Pagination from '@components/Pagination';
const MyPage = ({ result, searchData }) => {
return (
<Pagination searchData={searchData} result={result} />
);
};
export async function getServerSideProps(context) {
const { req, res, query, locale } = context;
const id = 'http://dbpedia.org/resource/France';
const { result = null } = await (
await fetch(`${absoluteUrl(req)}/api/entity?id=${id}`, {
headers: {
...req.headers,
'accept-language': locale,
},
})
).json();
if (!result && res) {
res.statusCode = 404;
}
const searchData = await getSearchData(context);
return {
props: {
result,
searchData,
},
};
}