react-mobile-only

1.0.3 • Public • Published

react-mobile-only

A react component that will only display its children on mobile resolutions.

Installation

The react-mobile-only package is available from NPM via yarn or the npm CLI.

npm i --save react-mobile-only

Usage

The component can be used by wrapping child components to restrict their display to mobile devices.

import MobileOnly from 'react-mobile-only'
 
const AppBanner = (props) => (
  <MobileOnly>
    Download our app from the <a href={app.play_store_url}>Play Store</a> or the <a href={app.app_store_url}>App Store</a>.
  </MobileOnly>
)

By default, the component will display for screen resolutions below 768px. By passing a mobileSize prop to the component, or by setting theme.mobileSize in the styled-components theme.

License

MIT

Package Sidebar

Install

npm i react-mobile-only

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

52.6 kB

Total Files

7

Last publish

Collaborators

  • lukem512