Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error of using goNextStatus in useVisibleStatus.ts #261

Open
kongshu612 opened this issue May 16, 2021 · 0 comments
Open

error of using goNextStatus in useVisibleStatus.ts #261

kongshu612 opened this issue May 16, 2021 · 0 comments

Comments

@kongshu612
Copy link

Checking goNextStatus() in useVisibleStatus.ts,
the source code look like this, for the switch condition, should we use prev instead of status?
function goNextStatus(callback?: () => void) {
cancelRaf();
rafRef.current = raf(() => {
// Only align should be manually trigger
setStatus((prev) => {
switch (status) { // should we use switch(prev) as it may be possible that react will combine multi setStatus together
case 'align':
return 'motion';
case 'motion':
return 'stable';
default:
}

    return prev;
  });

  callback?.();
});

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant