React hook for screenfull.js
npm install --save use-screenfull
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>
)
}
MIT © albinekb