A small, no external dependency hook that lets you know if the current viewport is mobile sized.
npm install --save screen-size-query
import React, { Component } from 'react'
import useSizeQuery from 'screen-size-query'
class Example extends Component {
render() {
const { size, isMobile } = useSizeQuery();
return (
<>
<h1>Size: {size}</h1>
<h1>IsMobile: {isMobile.toString()}</h1>
</>
)
}
}
MIT © tobycaulk