问题
A very strange one here, so if anybody can shed light on it I will be impressed.
Good
When I use a <h1 /> inside a component and build the server with npm run dev everything will work as expected.
I can replace the h1 with the <Query /> component from react-apollo the app reloads correctly and I receive data as I should.
Bad
However, if I restart the server either manually or with a /server file change. It will just hang indefinitely.
return (
<Query query={query}>
{({ loading, data, error, refetch }) => {
return (
<Layout>
<p>Admin</p>
<button onClick={getAllDetails}>Get All French Data</button>
</Layout>
)
}}
</Query>
)
I can assume that apollo is setup correctly as it works without a server reset.
Any ideas why it might hang with a fresh re-fresh and using <Query />?
来源:https://stackoverflow.com/questions/56728281/react-nextjs-wont-compile-when-using-react-apollo