-
Hi guys, I have a problem when using export const getStaticProps = async ({params}) => {
const {from, to} = params;
const [client, ssrCache] = createClient();
await client
.query( MY_QUEY, {
from,
to
},
).toPromise();
return {
props: {
from,
to,
urqlState: ssrCache.extractData(),
}
};
} const [{data}] = useQuery(MY_QUERY, {
variables: {
from,
to,
additional_var: 1 // <-- add more here
}
}); For the first time, the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
The hook always exposes previous data while it's loading new data. The code example you've shown here also doesn't really reflect the state of the hook. A result contains more properties apart from data that needs to be kept track off. Also, if you're in need of keeping track of changing data, it may also be worth to have your own |
Beta Was this translation helpful? Give feedback.
The hook always exposes previous data while it's loading new data. The code example you've shown here also doesn't really reflect the state of the hook. A result contains more properties apart from data that needs to be kept track off.
Also, if you're in need of keeping track of changing data, it may also be worth to have your own
useState
hook with either auseEffect
or an inline if statement that stores the state as it changes.