Skip to content

Commit ce3cd29

Browse files
Support react >= v16.8.0
1 parent ceff8d2 commit ce3cd29

File tree

3 files changed

+14
-302
lines changed

3 files changed

+14
-302
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
React Dynamic Tabs with full API
44

5+
> _Support react >= `v16.8.0`_
6+
57
### [Demo](https://dev-javascript.github.io/react-dyn-tabs/)
68

79
## Features
@@ -144,9 +146,13 @@ export default () => {
144146
});
145147
const addTab3 = function () {
146148
// open tab 3
147-
_instance.open({id: '3', title: 'Tab 3', panelComponent: (porps) => <p> panel 3 </p>});
149+
_instance.open({id: '3', title: 'Tab 3', panelComponent: (porps) => <p> panel 3 </p>}).then(() => {
150+
console.log('tab 3 is open');
151+
});
148152
// switch to tab 3
149-
_instance.select('3');
153+
_instance.select('3').then(() => {
154+
console.log('tab 3 is selected');
155+
});
150156
};
151157
return (
152158
<>
@@ -864,7 +870,6 @@ Parameters:
864870
```js
865871
const handler = React.useCallback(function (params) {
866872
const {currentSelectedTabId, previousSelectedTabId} = params;
867-
// can use 'this' here which refers to the instance
868873
}, []);
869874
instance.on('onSelect', handler);
870875
```
@@ -883,9 +888,7 @@ Parameters:
883888
**Example**
884889

885890
```js
886-
instance.one('onSelect', function ({currentSelectedTabId, previousSelectedTabId}) {
887-
// can use 'this' here which refers to the instance
888-
});
891+
instance.one('onSelect', function ({currentSelectedTabId, previousSelectedTabId}) {});
889892
```
890893

891894
### off

0 commit comments

Comments
 (0)