The animation name ("spin" in your initial sandbox) must refer to a set of keyframes.
A direct solution is to define the keyframes directly (not ideal, not neat, not extensible, etc.), see the keyframes in the style tag below.
You might want to check https://styled-components.com/docs/api#keyframes for a more neat solution.
import React from "react";
import { Container, createStyles, makeStyles } from "@material-ui/core";
import LoopIcon from "@material-ui/icons/Loop";
export const useStyles = makeStyles(() =>
createStyles({
rotateIcon: {
animation: "spin 4s linear infinite"
}
})
);
export default function App() {
const classes = useStyles();
return (
<Container maxWidth="sm">
<LoopIcon className={classes.rotateIcon} />
<style>{`
@keyframes spin {
0% { transform: rotate(360deg); }
100% { transform: rotate(0deg); }
}
`}</style>
</Container>
);
}
https://codesandbox.io/s/practical-fire-6k3cx?file=/App.tsx