Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

React component to render a subtree only when the browser is idle.

License

Notifications You must be signed in to change notification settings

fabiospampinato/react-idle-render

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Idle Render

React component to render a subtree only when the browser is idle.

Useful when an expensive subtree gets re-rendered frequently, by using this component we can skip some unnecessary re-renders, improving performance.

Install

npm install --save react-idle-render

Usage

import Idle from 'react-idle-render';

const MyComponent = () => (
  <Idle timeout={1000}>
    {() => {
      const result = someExpensiveFunction ();
      return <div>{result}</div>;
    }}
  </Idle>
);

License

MIT © Fabio Spampinato

About

React component to render a subtree only when the browser is idle.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published