Open
Description
Is there any reason why this package isn't written so that it can be used like this:
<Media breakpoint="mobile">
...
</Media>
<Media breakpoint="desktop">
...
</Media>
So that the children are conditionally rendered?
I'm a little confused by your render props example in the readme file, should it be:
import { Media } from 'react-breakpoints'
class Navigation extends React.Component {
render() {
return (
<Media render={({ breakpoints, currentBreakpoint }) =>
breakpoints[currentBreakpoint] > breakpoints.desktop ? (
<DesktopNavigation />
) : (
<TouchNavigation />
)
}
/>
)
}
}
export default Navigation
As surely the breakpoints
are captured in the Media
component using context and currentBreakpoint
is calculated by Media
?