react-responsive-ssr
npm i react-responsive-ssr
Deprecated!
This project has reached the end of its development. Please use builtin solution https://www.npmjs.com/package/react-responsive\#server-side-rendering

react-responsive-ssr

React Responsive with SSR support

by infinum

0.4.1 (see all)License:MITTypeScript:Built-In
npm i react-responsive-ssr
Readme

[DEPRECATED]

This project has reached the end of its development. Please use builtin solution eact-responsive#server-side-rendering.

React Responsive SSR

// TODO

Install

Note: react-responsive-ssr has a peer dependency to react, react-dom, prop-types, react-responsive and mobile-detect, so don't forget to install those packages.

npm install --save react react-dom prop-types react-responsive mobile-detect react-responsive-ssr
yarn add react react-dom prop-types react-responsive mobile-detect react-responsive-ssr

Usage

With Next.js:

import { ResponsiveProvider, Responsive } from 'react-responsive-ssr';

class App extends React.Component<any, any> {
  public static async getInitialProps(context: INextContext): Promise<any> {
    let responsive: Responsive;

    if (context.req) {
      responsive = new Responsive(context.req);
    }

    return {
      responsive,
    }
  }

  public render() {
    return (
      <ResponsiveProvider value={this.props.responsive}>
        // ...
      </ResponsiveProvider>
    );
  }
}

In component:

import { MediaQuerySSR } from 'react-responsive-ssr';

// ...
  public render() {
    // ...
    return (
      <MediaQuerySSR maxWidth={991}>
        // ...
      </MediaQuerySSR>
    );
  }
// ...

Concepts

// TODO

License

The MIT License

Credits

react-responsive-ssr is maintained and sponsored by Infinum.

Downloads/wk

163

GitHub Stars

11

LAST COMMIT

2yrs ago

MAINTAINERS

11

CONTRIBUTORS

4

OPEN ISSUES

0

OPEN PRs

12
VersionTagPublished
0.4.1
latest
2yrs ago
No alternatives found
No tutorials found
Add a tutorial