-1

The code I am using:

<TextField onChanged={e => this.handleCommChange(e, 'Contact')}

private handleCommChange(e: any, controlType: any): void {
    const { temp_items } = this.state;
    const value = e;

    this.setState({
      temp_items: {
        ...temp_items,
        [controlType]: value
      }
    });
    //console.log(controlType);
    console.log(this.state);
} 

I Want to implement debounce in SPFx web part created using react js.

Please help me.

Thanks.

  • This question shows a lack of research and doesn't refer to any existing documentation like lodash.com/docs/4.17.11#debounce – baywet Feb 8 at 14:22
  • If it is in jquery ... I may not ask the question . As I am new es6 & spfx so I asked the question . If you can give me documentation of SPFX React (debounce) I will thank full . – BISWANATH HALDER Feb 9 at 9:09
1

You could leverage lodash debounce and wrap your method's body as the debounce parameter (callback)

  • than you . But I am in spfx react .. does this work ? please suggest . – BISWANATH HALDER Feb 9 at 9:10
  • Yes, you just need to add the lodash library – baywet Feb 9 at 11:52
  • ok. Than you. I will try. – BISWANATH HALDER Feb 9 at 15:34
  • Don't forget to mark the answer :) – baywet Feb 9 at 22:48

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.