Last active
June 15, 2018 06:28
-
-
Save icyJoseph/b214110365586fe35a91e2bf0bb07aaa to your computer and use it in GitHub Desktop.
Responsive content passing props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Media from 'react-media'; | |
const Mobile = ({ title }) => <div>{title} Mobile</div>; | |
const Desktop = ({title}) => <div>{title} Desktop</div>; | |
const Responsive = ({ ...props }) => ( | |
<Media query={{ maxWidth: 1023 }}> | |
{matches => (matches ? <Mobile {...props} /> : <Desktop {...props} />)} | |
</Media> | |
); | |
export default Responsive; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment