@@ -8,7 +8,7 @@ import { ApiContext, StateContext, ForceUpdateContext } from "../utils/context.j
8
8
function useDynamicTabs ( options ) {
9
9
const ref = useRef ( null ) ;
10
10
if ( ref . current === null )
11
- ref . current = { api : new ( Api ) ( { options } ) , TabListComponent : null , PanelListCompoent : null } ;
11
+ ref . current = { api : new ( Api ) ( { options } ) , TabListComponent : null , PanelListComponent : null } ;
12
12
const { current : { api } } = ref
13
13
, _ref = ref . current
14
14
, [ state , dispatch ] = useReducer ( reducer , api . getInitialState ( ) ) ;
@@ -29,9 +29,9 @@ function useDynamicTabs(options) {
29
29
if ( ! _ref . TabListComponent )
30
30
_ref . TabListComponent = ( props = { } ) => {
31
31
return (
32
- < ApiContext . Provider value = { _ref . api } >
33
- < StateContext . Provider value = { _ref . api . stateRef } >
34
- < ForceUpdateContext . Provider value = { _ref . api . forceUpdateState } >
32
+ < ApiContext . Provider value = { api } >
33
+ < StateContext . Provider value = { api . stateRef } >
34
+ < ForceUpdateContext . Provider value = { api . forceUpdateState } >
35
35
< TabList { ...props } > props.children</ TabList >
36
36
</ ForceUpdateContext . Provider >
37
37
</ StateContext . Provider >
@@ -40,14 +40,14 @@ function useDynamicTabs(options) {
40
40
} ;
41
41
if ( ! _ref . PanelListCompoent )
42
42
_ref . PanelListCompoent = props => (
43
- < ApiContext . Provider value = { _ref . api } >
44
- < StateContext . Provider value = { _ref . api . stateRef } >
45
- < ForceUpdateContext . Provider value = { _ref . api . forceUpdateState } >
43
+ < ApiContext . Provider value = { api } >
44
+ < StateContext . Provider value = { api . stateRef } >
45
+ < ForceUpdateContext . Provider value = { state } >
46
46
< PanelList { ...props } > props.children</ PanelList >
47
47
</ ForceUpdateContext . Provider >
48
48
</ StateContext . Provider >
49
49
</ ApiContext . Provider >
50
50
) ;
51
- return [ _ref . TabListComponent , _ref . PanelListCompoent , _ref . api . userProxy ] ;
51
+ return [ _ref . TabListComponent , _ref . PanelListCompoent , api . userProxy ] ;
52
52
}
53
53
export default useDynamicTabs ;
0 commit comments