Optimize util structure

This commit is contained in:
2023-11-30 13:57:45 +08:00
parent bf8f915b15
commit f595cb380a
19 changed files with 285 additions and 285 deletions

16
src/util/hooks.tsx Normal file
View File

@@ -0,0 +1,16 @@
import React from 'react'
export const useUpdatedEffect = (
effect: React.EffectCallback,
dependencies: React.DependencyList
) => {
const isFirstRender = useRef(true)
useEffect(() => {
if (isFirstRender.current) {
isFirstRender.current = false
} else {
effect()
}
}, dependencies)
}