Skip to content

Commit 9759890

Browse files
authored
chore: replace React.useState (#21)
1 parent 7bc540c commit 9759890

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"dependencies": {
4444
"@babel/runtime": "^7.11.1",
4545
"classnames": "^2.2.1",
46-
"rc-util": "^5.2.1"
46+
"rc-util": "^5.18.1"
4747
},
4848
"devDependencies": {
4949
"@types/classnames": "^2.2.9",

src/hooks/useStepQueue.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import * as React from 'react';
2-
import {
2+
import type {
33
StepStatus,
4+
MotionStatus} from '../interface';
5+
import {
46
STEP_PREPARE,
57
STEP_ACTIVE,
68
STEP_START,
79
STEP_ACTIVATED,
8-
STEP_NONE,
9-
MotionStatus,
10+
STEP_NONE
1011
} from '../interface';
1112
import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect';
1213
import useNextFrame from './useNextFrame';
14+
import useState from './useState';
1315

1416
const STEP_QUEUE: StepStatus[] = [
1517
STEP_PREPARE,
@@ -33,7 +35,7 @@ export default (
3335
step: StepStatus,
3436
) => Promise<void> | void | typeof SkipStep | typeof DoStep,
3537
): [() => void, StepStatus] => {
36-
const [step, setStep] = React.useState<StepStatus>(STEP_NONE);
38+
const [step, setStep] = useState<StepStatus>(STEP_NONE);
3739

3840
const [nextFrame, cancelNextFrame] = useNextFrame();
3941

@@ -53,7 +55,7 @@ export default (
5355
setStep(nextStep);
5456
} else {
5557
// Do as frame for step update
56-
nextFrame((info) => {
58+
nextFrame(info => {
5759
function doNext() {
5860
// Skip since current queue is ood
5961
if (info.isCanceled()) return;

0 commit comments

Comments
 (0)