Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lukem512/react-mobile-only

A react component that will only display its children on mobile resolutions.
https://github.com/lukem512/react-mobile-only

component jsx mobile mobile-web react

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# react-mobile-only
[![npm](https://img.shields.io/npm/l/react-mobile-only)](https://www.npmjs.com/package/react-mobile-only) [![npm](https://img.shields.io/npm/v/react-mobile-only)](https://www.npmjs.com/package/react-mobile-only) [![npm](https://img.shields.io/npm/dm/react-mobile-only)](https://www.npmjs.com/package/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.

```js
import MobileOnly from 'react-mobile-only'

const AppBanner = (props) => (

Download our app from the Play Store or the App Store.

)
```

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](https://www.styled-components.com/docs/advanced#theming) theme.

## Related

See [react-desktop-only](https://github.com/lukem512/react-desktop-only)

## License

MIT