useEffectOnce()
2022年5月1日小于 1 分钟
useEffectOnce()
Question
Here is a simple problem, implement useEffectOnce()
as the name says itself, it runs an effect only once.
Code
import { EffectCallback } from 'react'
export function useEffectOnce(effect: EffectCallback) {
// your code here
}
// if you want to try your code on the right panel
// remember to export App() component like below
// export function App() {
// return <div>your app</div>
// }