We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
lodash debounce in React functional component not working Lodash debounce not working in React 看起來應該是因為 react functional component render 產生的 instance 不一樣 will be a new function for every render. You can use the useCallback hook to make sure that the same function is being persisted between renders and it will work as expected.
The text was updated successfully, but these errors were encountered:
// initial render register addEventListener once useEffect(() => { window.addEventListener('scroll', onScroll) return () => window.removeEventListener('scroll', onScroll) }, []) const onScroll = _.throttle(() => { setValue(value) }, 100)
Sorry, something went wrong.
No branches or pull requests
lodash debounce in React functional component not working
Lodash debounce not working in React
看起來應該是因為 react functional component render 產生的 instance 不一樣
will be a new function for every render. You can use the useCallback hook to make sure that the same function is being persisted between renders and it will work as expected.
The text was updated successfully, but these errors were encountered: