Nextjs throws an error: Error: Invalid hook call. Hooks can only be called inside of the body of a function component.
Whenever I try to access useContext
Value in getStaticPaths()
function.
Here's my code:
export async function getStaticPaths() {
const { videos } = useVideos();
const paths = videos.map((video: any) => {
return {
params: { id: video.videoId },
};
});
return {
paths,
fallback: false,
};
}