1.0.0 • Published 7 years ago

react-responsive-hoc v1.0.0

Weekly downloads
85
License
Apache-2.0
Repository
github
Last release
7 years ago

react-responsive-hoc

Build Status NPM version

Wrapper around react-responsive to work with SSR.

This module exports a provider for defining the default device (for SSR) and a modified MediaQuery from react-responsive to use the default device.

Installation

$ yarn add react-responsive-hoc

Usage

import { MediaQueryProvider, MediaQuery } from 'react-responsive-hoc';

const Example = () => {
    return (
        <MediaQuery query="(min-device-width: 1224px)">
            On Desktop only
        </MediaQuery>
    )
};

const App = () => {
    return (
        <MediaQueryProvider width={1600} height={800}>
            <Example />
        </MediaQueryProvider>
    );
}