react-useonload
v1.0.2
Published
React hook for onload
Downloads
1
Readme
react-useonload
A small, zero dependency React hook that only runs once the component has loaded.
Get
yarn add react-useonload
# or
npm install react-useonload
Use
import useOnload from 'react-useonload'
const App = () => {
useOnload(() => {
console.log('this will only run once the component loads')
})
// Async callbacks!
useOnload(async () => {
await someAsyncFunction()
console.log('this will only run once the component loads')
})
}
Fin
by: Jeff Miller https://jamiller.me | [email protected]