react-screen-onresize-mixin

1.0.1 • Public • Published

React screen resize listener mixin

A simple React mixin who handle screen resize detection from your React components.

Installation

npm install react-screen-onresize-mixin --save

Usage

// Import the mixin
import ScreenResizeMixin from 'react-screen-onresize-mixin';

const MyComponent = React.createClass({
  mixins: [ ScreenResizeMixin ], // add it to your component

  onScreenResize() {
    // This function is executed
    // each time the window is resized
  }
});

By default the function onScreenResize is executed after a delay of 250ms without resizing to prevent so many calls. This delay can be changed :

mixins: [ ScreenResizeMixin.delay( 500 ) ]

Package Sidebar

Install

npm i react-screen-onresize-mixin

Weekly Downloads

0

Version

1.0.1

License

WTFPL

Last publish

Collaborators

  • barrailla