import { useEffect , useReducer , useRef } from 'react' ; import { effect , stop , ReactiveEffect } from '@vue/reactivity' ; export const useForceUpdate = ( ) => { const [ , forceUpdate ] = useReducer ( s => s + 1 , 0 ) ; return forceUpdate ; } ; export const useEffection = ( ... effectArgs ) => { const effectionRef = useRef < ReactiveEffect > ( ) ; if ( ! effectionRef . current ) { effectionRef . current = effect ( ... effectArgs ) ; } const stopEffect = ( ) => { stop ( effectionRef . current ! ) ; } ; useEffect ( ( ) => stopEffect , [ ] ) ; return effectionRef . current ; } ;