Skip to content

Commit

Permalink
Merge pull request #100 from sonaye/master
Browse files Browse the repository at this point in the history
Document common use cases
  • Loading branch information
contra committed Jun 13, 2017
2 parents 44a7bf8 + b917322 commit d580547
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,34 @@ var A = React.createClass({
});
```

### Common use cases

```javascript
import Responsive from 'react-responsive';

// Desktop, tablet and mobile setup
const Desktop = ({ children }) => <Responsive minWidth={992} children={children} />;
const Tablet = ({ children }) => <Responsive minWidth={768} maxWidth={992} children={children} />;
const Mobile = ({ children }) => <Responsive maxWidth={768} children={children} />;

// Default (desktop, tablet) and mobile setup
const Default = ({ children }) => <Responsive minWidth={768} children={children} />;
const Mobile = ({ children }) => <Responsive maxWidth={768} children={children} />;

const Example = () => (
<div>
<Desktop>You are a desktop or laptop</Desktop>
<Tablet>You are a tablet</Tablet>
<Mobile>You are a mobile phone</Mobile>

<Default>You are not a mobile phone</Default>
<Mobile>You are a mobile phone</Mobile>
</div>
);

export default Example;
```

## Browser Support

### Out of the box
Expand Down

0 comments on commit d580547

Please sign in to comment.