Skip to content

A react component for delayed rendering of child components.

License

Notifications You must be signed in to change notification settings

sanehab/react-delayed-renderer

Repository files navigation

DelayedRenderer

A react component for delayed rendering of child components.

Installation

The package can be installed via NPM:

npm install react-delayed-renderer

This package has no dependencies, only react and prop-types are peer dependencies that you have to install yourself, you need to install react version that supports hooks.

Usage

import { DelayedRenderer } from "react-delayed-renderer"
const Component = () => {
  // notice that changing delay will cause the children to be hidden again
  return (
    <DelayedRenderer delay={300} onRender={() => console.log("rendered")}>
      <div />
    </DelayedRenderer>
  )
}
Prop Type Description
delay Integer Delay in millesconds
onRender Function callback function to be called when the component renders the children

License

Licensed under MIT license, see LICENSE for the full license.

About

A react component for delayed rendering of child components.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published