export const getServerSideProps: GetServerSideProps = async (context) => {
const { isLoading, error, data } = useQuery('repoData', () =>
fetch(
'https://api.github.com/repos/tannerlinsley/react-query'
).then((res) => res.json())
)
console.log({ data })
return {
props: {
data,
},
}
尽管在stackoverflow中有很多与react invalid hook call相关的问题,但仍然没有一个能够解决我的问题。