react-component-rotator
v0.1.1
Published
React component that rotates display of it's children
Downloads
2
Readme
React Component Rotator
What is it
React Component Rotator is a React component (No Way!) that can rotate display of it's children. The children can be homogeneous or heterogeneous in their types
- JavaScript Basic Types
- DOM Elements
- Other React Componenents
- A mix of all of the above
- or anything else JSX can display!
Why
It is easy to start getting React to swap out elements useing something like setInterval/setTimout, but if you are not careful you may be creating the listeners on each render of a component React Componenent Rotator takes care of this by cleaning up after itself when setting up intervals and timeouts, creating one place to handle this set up and tear down logic
Table of Contents
Installation
Add the dependency with npm or yarn
npm i react-component-rotator
yarn add react-component-rotator
Usage
import ComponentRotator from "react-component-rotator";
// ...
<ComponentRotator children={[<h2>Lie</h2>, <h2>Cheat</h2>, <h2>Steal</h2>]} />;
Support
Please open an issue for support.
Contributing
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.