Replies: 1 comment 3 replies
-
I had no idea that this is working, and typescript would definitely not allow it. What problem are you trying to solve please that you feel the need to attach custom properties onto the options object? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
When we create a new query we can pass an options object. It is not explicitly stated that we can pass arbitrary parameters, but this works.
const { isLoading, error, data } = useQuery('repoData', dataFetchFn, { customOption: 'foo' });
When we later try to iterate over all queries, we can get back this customOption.
queryCache.findAll().map(q => q.options.CustomOption)
=>['foo']
Is this behaviour likely to break in the feature, or is it ok to use it this way ? If not is there a better/safer way ?
Beta Was this translation helpful? Give feedback.
All reactions