-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hooks not wrapped with useCallback cause contant re-renders #87
Comments
Hi @JustMeGaaRa, thanks for spotting that, we'll fix this in the next patch release |
@JustMeGaaRa Fixed in v2.1.2. Please remember to wrap your props that you pass to useFilePicker with const ufpProps = useMemo(() => ({ accept: ".dsl", multiple: false }),[]);
const { openFilePicker } = useFilePicker(ufpProps); This should result in a steady reference to |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use the "openFilePicker" function in my callback, and pass this callback to useEffect, and since "openFilePicker" is not wrapped in useCallback, the function constantly changes and triggers my useEffect, hence creating a constant rerendering of my UI.
Code sample:
`
`
The text was updated successfully, but these errors were encountered: