Put extra arguments for the getData callback
vladyslavKucheruk opened this issue · 4 comments
I have an intention to use getData
function like this:
const customParams = undefined;
const { getData } = useVisitorData(customParams, { immediate: false });
...
const onSubmit = async () => {
const response = await axios.get(...);
await getData({ ignoreCache: true }, { linkedId: response.id, tag: { action: 'EXAMPLE_ACTION' } })
}
I cannot do that as getData
doesn't take extra arguments.
Which means I have to define custom arguments statically, when I initialize useVisitorData
hook.
Could you please correct me if I am wrong with the usage or provide the solution for this specific case.
Thank you!
Hi @vladyslavKucheruk,
Thank you for the issue. I agree with you, it makes sense!
I'll provide a solution for your case soon.
🎉 This issue has been resolved in version 2.4.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
@vladyslavKucheruk you can try v2.4.0
.
Just pass options to the getData
function like:
const onSubmit = async () => {
const response = await axios.get(...);
await getData({ ignoreCache: true, linkedId: response.id, tag: { action: 'EXAMPLE_ACTION' } })
}
Thank you so much, I appreciate your support. Now it looks more similar to js and RN packages!