use-screenfull
v0.0.4
Published
React hook for screenfull.js
Downloads
253
Readme
use-screenfull
React hook for screenfull.js
Install
npm install --save use-screenfull
Usage
import * as React from 'react'
import { useScreenfull } from 'use-screenfull'
const Example = () => {
const { isFullscreen, toggle, requestFullscreen } = useScreenfull()
const scale = isFullscreen ? 1 : 0.1
return (
<div>
{isFullscreen ? 'yes' : 'no'}{' '}
<img
onClick={requestFullscreen}
src="https://placekitten.com/1920/1080"
width={1920 * scale}
height={1080 * scale}
/>
</div>
)
}
License
MIT © albinekb