I am trying to clone the following next.js react app and run it on localhost:3000
https://github.com/elee-ittdublin/lab6-nextjs
when I open localhost:3000 I get the following error
Unhandled Rejection (ReferenceError): fetch is not defined Function._callee$ ./pages/index.js:22
20 | // see https://nextjs.org/learn/basics/fetching-data-for-pages
>22 | Index.getInitialProps = async function() {
24 | const url = 'https://api.tvmaze.com/search/shows?q=batman';
I have tried to research what I am doing wrong but I still can not fix my problem. Can anyone see where I am going wrong?
Cheers
If you go to the examples here examples and search for fetch, you will see what they are using. In the examples is node-fetch - node-fetch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With