Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React form 'react'
- // ...
- class MyDebouncedComponent extends React.Component {
- // ...
- debouncedOnChange({ param1, param2 }) {
- clearTimeout(this.timer);
- this.timer = setTimeout(() => {
- // logic...
- this.setState({ param1, param2 })
- }, 300);
- }
- // ...
- render() {
- return (
- // ...
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement