| import { useEffect } from 'react'; | |
| const useLifecycles = (mount, unmount?) => { | |
| useEffect(() => { | |
| if (mount) { | |
| mount(); | |
| } | |
| return () => { | |
| if (unmount) { | |
| unmount(); | |
| } | |
| }; | |
| }, []); | |
| }; | |
| export default useLifecycles; | |
| import { useEffect } from 'react'; | |
| const useLifecycles = (mount, unmount?) => { | |
| useEffect(() => { | |
| if (mount) { | |
| mount(); | |
| } | |
| return () => { | |
| if (unmount) { | |
| unmount(); | |
| } | |
| }; | |
| }, []); | |
| }; | |
| export default useLifecycles; | |