Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98225367
useTabs.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jan 11, 05:49
Size
960 B
Mime Type
text/x-java
Expires
Mon, Jan 13, 05:49 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23535941
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
useTabs.js
View Options
import
*
as
React
from
'react'
;
import
{
unstable_useControlled
as
useControlled
,
unstable_useId
as
useId
}
from
'@mui/utils'
;
const
useTabs
=
parameters
=>
{
const
{
value
:
valueProp
,
defaultValue
,
onChange
,
orientation
,
direction
,
selectionFollowsFocus
}
=
parameters
;
const
[
value
,
setValue
]
=
useControlled
({
controlled
:
valueProp
,
default
:
defaultValue
,
name
:
'Tabs'
,
state
:
'value'
});
const
idPrefix
=
useId
();
const
onSelected
=
React
.
useCallback
((
e
,
newValue
)
=>
{
setValue
(
newValue
);
if
(
onChange
)
{
onChange
(
e
,
newValue
);
}
},
[
onChange
,
setValue
]);
const
tabsContextValue
=
React
.
useMemo
(()
=>
{
return
{
idPrefix
,
value
,
onSelected
,
orientation
,
direction
,
selectionFollowsFocus
};
},
[
idPrefix
,
value
,
onSelected
,
orientation
,
direction
,
selectionFollowsFocus
]);
return
{
tabsContextValue
};
};
export
default
useTabs
;
Event Timeline
Log In to Comment