axios-hooks
axios-hooks copied to clipboard
Type error: MouseEvent using refetch and provided example from docs
Type error: Type '(config?: AxiosRequestConfig<any> | undefined, options?: RefetchOptions | undefined) => AxiosPromise<any>' is not assignable to type 'MouseEventHandler<HTMLButtonElement>'.
Types of parameters 'config' and 'event' are incompatible.
Type 'MouseEvent<HTMLButtonElement, MouseEvent>' has no properties in common with type 'AxiosRequestConfig<any>'.
11 | return (
12 | <div>
> 13 | <button onClick={refetch}>refetch</button>
| ^
14 | <pre>{JSON.stringify(data, null, 2)}</pre>
15 | </div>
16 | )
Would you like to send a PR? We support sending events to the refetch function for convenience (so it can be used in event handlers) but this is apparently not reflected in the types. It should be a fairly straightforward change.
🎉 This issue has been resolved in version 4.0.0 🎉
The release is available on:
Your optic bot 📦🚀