mq-react
The media queries for your React components. Flow-compatible.
Install
npm install --save mq-react
Usage
Example code
;;; const TestComponent = <pre>JSON</pre>;TestComponentdefaultProps = mq: undefined ; const Decorated = ; static childContextTypes = mq: PropTypes ; /** * You can use the context for define app defaults */ { return mq: isDesktop: '(min-width: 1024px)' ; } { return thispropschildren; } window;
Render result
{ "mq": { "isDesktop": "(min-width: 1024px)", "isMobile": "(max-width: 1023px)" }, "isDesktop": true, <!-- true if window width >= 1024px --> "isMobile": false <!-- true if window width < 1024px -->}