-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.

2
  • This question shows a lack of research and doesn't refer to any existing documentation like lodash.com/docs/4.17.11#debounce
    – baywet
    Commented Feb 8, 2019 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 . Commented Feb 9, 2019 at 9:09

1 Answer 1

1

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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