1 | 'use client';
|
2 |
|
3 | import * as React from 'react';
|
4 | import { TransitionContext } from './TransitionContext';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | export function useTransitionStateManager() {
|
18 | const transitionContext = React.useContext(TransitionContext);
|
19 | if (!transitionContext) {
|
20 | throw new Error('Missing transition context');
|
21 | }
|
22 | const {
|
23 | registerTransition,
|
24 | requestedEnter,
|
25 | onExited
|
26 | } = transitionContext;
|
27 | React.useEffect(() => {
|
28 | return registerTransition();
|
29 | }, [registerTransition]);
|
30 | return {
|
31 | onExited,
|
32 | requestedEnter
|
33 | };
|
34 | } |
\ | No newline at end of file |