سؤال

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.

هل كانت مفيدة؟

المحلول

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top