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:
833833** Example**
834834
835835``` js
836- instance . on ( ' onSelect ' , function (params ) {
836+ const handler = React . useCallback ( function (params ) {
837837 const {currentSelectedTabId , previousSelectedTabId } = params;
838838 // can use 'this' here which refers to the instance
839- });
839+ }, []);
840+ instance .on (' onSelect' , handler);
840841```
841842
842843### one
@@ -872,12 +873,13 @@ Parameters:
872873** Example**
873874
874875``` 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);
879882};
880- instance .on (' onSelect' , onSelectHandler);
881883```
882884
883885### getData
You can’t perform that action at this time.
0 commit comments