File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -1508,20 +1508,20 @@ export function useThrottle(value, interval = 500) {
1508
1508
}
1509
1509
1510
1510
export function useTimeout ( cb , ms ) {
1511
- const intervalRef = React . useRef ( null ) ;
1511
+ const id = React . useRef ( null ) ;
1512
1512
const onTimeout = React . useEffectEvent ( cb ) ;
1513
1513
1514
- const handleClearInterval = ( ) => {
1515
- window . clearInterval ( intervalRef . current ) ;
1514
+ const handleClearTimeout = ( ) => {
1515
+ window . clearTimeout ( id . current ) ;
1516
1516
} ;
1517
1517
1518
1518
React . useEffect ( ( ) => {
1519
- intervalRef . current = window . setTimeout ( onTimeout , ms ) ;
1519
+ id . current = window . setTimeout ( onTimeout , ms ) ;
1520
1520
1521
- return handleClearInterval ;
1521
+ return handleClearTimeout ;
1522
1522
} , [ ms ] ) ;
1523
1523
1524
- return handleClearInterval ;
1524
+ return handleClearTimeout ;
1525
1525
}
1526
1526
1527
1527
export function useToggle ( initialValue ) {
You can’t perform that action at this time.
0 commit comments