React component and hook to keep screen awake.
npm install react-keep-awakeReact component and hook to keep screen awake using Screen Wake Lock API.
``bash`
npm install react-keep-awake
To keep screen awake by component:
`jsx
import { KeepAwake } from 'react-keep-awake'
const MyApp = () => { Lorem ipsum
return (
)
}
`
To keep screen awake by hook:
`jsx
import { useKeepAwake } from 'react-keep-awake'
const MyApp = () => {
useKeepAwake()
return ( Lorem ipsum
)
}
`
`bash``
npm ci
npm run dev