Skip to content

cfreshman/use-f

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

import { useF, useE } from 'use-f';

Replace useEffect with useF for functions without clean-up

useEffect(() => {
    // do something with arg1 and arg2
}, [arg1, arg2])

useF(arg1, arg2, () => {
    // do something with arg1 and arg2
})
useEffect(() => {
    doSomethingWithArg3()
}, [arg3])

useF(arg3, doSomethingWithArg3)

Or, replace with useE to keep clean-up

useE(arg4, () => {
    // do something with arg4 that requires clean-up
    return () => {
      // do clean-up
    }
})

About

useF, syntactic sugar for React useEffect

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published