Api not fetching on Nextjs Static HTML export

Viewed 44

I am trying to do Nextjs Static HTML export. I am using next js with tailwind CSS. At first the styles were not being applied. Then under out folder on every index.html page, I changed link from "/_next/static/..." to "./_next". And apparently style seems to work.

not styled image

to styled image

Then, I got into another problem; I am fetching Api on Context Api useEffect through fetcher function with axios. My current code is my code picture

Now the problem is when i run the site with yarn dev the fetching works perfectly, Please note the Request URL. fetcing image

But when open the site through static html, the request url changes to apparently file url. I am not sure of it. Can anyone please help me with it? And Can I use React Context Api in next html export as if it is like Single Page Application?

enter image description here

0 Answers
Related