I need to use getserversideprops in components like I used in the pages. but I'm stuck how can I pass the sanity data into components?
edit: solved I was missing the props :)
CodePudding user response:
According to Next.Js docs,
getServerSidePropscan only be exported from a page. You can’t export it from non-page files.
So, you have to call getServerSideProps inside a page component and not any other component.
You can use getServerSideProps inside a page, which wraps your component and pass data down to component.
