Skip to content

Commit

Permalink
review(useCSSTransition): unwrap useState condition block
Browse files Browse the repository at this point in the history
Co-authored-by: Daniil Suvorov <[email protected]>
  • Loading branch information
inomdzhon and SevereCloud authored Nov 5, 2024
1 parent 7446099 commit 93d235b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/vkui/src/lib/animation/useCSSTransition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,16 @@ export const useCSSTransition = <Ref extends Element = Element>(

const ref = useRef<Ref | null>(null);
const [state, setState] = useState<UseCSSTransitionState>(() => {
if (inProp) {
if (enableAppear) {
onEnter(true);
return 'appear';
}
return 'entered';
if (!inProp) {
return 'exited';
}

if (enableAppear) {
onEnter(true);
return 'appear';
}

return 'exited';
return 'entered';
});
const prevState = usePrevious(state);

Expand Down

0 comments on commit 93d235b

Please sign in to comment.