Skip to content

This is a react render prop component that will inject the window dimensions. Uses a single window event listener for all instances.

Notifications You must be signed in to change notification settings

sheldonj/react-resize-render

Repository files navigation

react-resize-render

Build Status npm version npm

A render prop solution for tracking window resize events in a browser. Uses a single event handler for all instances of the render prop componenent to attempt to maximize perforance by limiting multiple resize events.

Getting Started

  npm install react-resize-render -S 
// using ES6 modules
  import RenderResize from 'react-resize-render';

  <RenderResize
    render={({width, height}) => {
      return (
        <div>
          {width}px - {height}px
        </div>
      );
    }}
  />

Checkout the storybook site for more examples.

About

This is a react render prop component that will inject the window dimensions. Uses a single window event listener for all instances.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •