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!
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
Add the dependency with npm or yarn
npm i react-component-rotator
yarn add react-component-rotator
import ComponentRotator from "react-component-rotator";
// ...
<ComponentRotator children={[<h2>Lie</h2>, <h2>Cheat</h2>, <h2>Steal</h2>]} />;
Please open an issue for support.
Please contribute using Github Flow. Create a branch, add commits, and open a pull request.