useMobileDetect
React hook to add mobile info to body
Note: This is using the new React Hooks API
You'll need to install
react
,react-dom
, etc at^16.8.0
or above
Install
yarn add @alobato/use-mobile-detect
Usage
import useMobileDetect from '@alobato/use-mobile-detect'
export default memo(() => {
useMobileDetect()
...
<Text css={css`body.mobile & { display: none; }`}>Text 1</Text>
<Text css={css`body:not(.mobile) & { display: none; }`}>Text 2</Text>