Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default () => {
const {
pages,
isLoadingMore,
isReachingEnd,
loadMore
} = useSWRPages(
// page key
'demo-page',
// page component
({ offset, withSWR }) => {
const { data: projects } = withSWR(
// use the wrapper to wrap the *pagination API SWR*
useSWR('/api/projects?offset=' + (offset || 0), fetch)
)
// you can still use other SWRs outside
if (!projects) {
return <p>loading</p>
}
return projects.map(project =>