-
Notifications
You must be signed in to change notification settings - Fork 75
Pagination - TypeError: Cannot read property 'load' of undefined #202
Comments
I also tried to implement the pagination example last week, but I got similar errors as well. I gave up and implemented a Load More button instead. I will be interested in a solution as well |
Hello! @alexanderfountain maybe you can share your |
@veloce I am facing a similar issue. The error is I built this based on the pagination example but removed the pagination logic to get the basic version working first. Here is an example implementation (note that the code is in a |
@Giulico Thank you for that insight! 👍 |
Running 3.6.2 version
I am attempting to switch my source tool from gatsby-source-prismic to gatsby-source-prismic-graphql. Can't seem to get pagination going on my blog index page.
I set my page up just like the pagination example.
My first error is "React Hook "useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render."
Commenting out
if (!data) { return <div>no data</div> }
Resolves this error.. Or you could add it to the useEffect hook.
The next error I can't resolve is
"TypeError: Cannot read property 'load' of undefined" which is coming from this line:
props.prismic .load({ variables: { after: getCursorFromDocumentIndex(page) } }) .then(res => setData(res.data)); }, [page]);
If i console log props indeed I do not see prismic.
Side note:
I cloned the pagination example. Ran npm install, and ran gatsby develop, could not get this to spin up at all with a promise error.
The text was updated successfully, but these errors were encountered: