File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -833,10 +833,11 @@ Parameters:
833
833
** Example**
834
834
835
835
``` js
836
- instance . on ( ' onSelect ' , function (params ) {
836
+ const handler = React . useCallback ( function (params ) {
837
837
const {currentSelectedTabId , previousSelectedTabId } = params;
838
838
// can use 'this' here which refers to the instance
839
- });
839
+ }, []);
840
+ instance .on (' onSelect' , handler);
840
841
```
841
842
842
843
### one
@@ -872,12 +873,13 @@ Parameters:
872
873
** Example**
873
874
874
875
``` js
875
- const onSelectHandler = function (params ) {
876
- const {currentSelectedTabId , previousSelectedTabId } = params;
877
- // can use 'this' here which refers to the instance
878
- this .off (' onSelect' , onSelectHandler);
876
+ const handler = React .useCallback (function () {}, []);
877
+ const attachHandler = () => {
878
+ instance .on (' onSelect' , handler);
879
+ };
880
+ const deattachHandler = () => {
881
+ instance .off (' onSelect' , handler);
879
882
};
880
- instance .on (' onSelect' , onSelectHandler);
881
883
```
882
884
883
885
### getData
You can’t perform that action at this time.
0 commit comments