Control spin speed by setting an initial property then propagate it to a react hook to be dynamically changed.
const SPEED = 0;const kind = React.createElement,container = "react-container";const tags = { cat : document.querySelector('[data-cat]'), burger : document.querySelector('[data-burger]')}class Main extends React.Component { constructor(props){ super(props) } componentDidMount() { alert("say cheeze!") } render() { const kinds = []; Object.keys(tags).map(function(key, index) { const targets = { key : index, tag : tags[key].tagName.toLowerCase(), src : tags[key].src, SPEED } kinds.push(kind(Spin, targets)) }); return kinds }}const Spin = function(props) { const [speed, go] = React.useState(props.SPEED); const startSpin = function() { go(speed + 1) }; React.useEffect(function() { startSpin() }, []); return kind(props.tag, { style : { animation : `spin ${speed}s linear infinite` }, src : props.src })}
Demo https://gif.com.ai?id=QmagKQ16ZhwPMGunhWuiKydEJFW3y4MprxYeTNjbC87MxZ