function onPlay(sound) {
...
const audio = new Audio(sound);
audio.play()
...
}
componentDidMount() { onPlay(sound) }
export default function Method({title, description, name, isActive}) {
const dispatch = useDispatch()
return (
<Card className={style.method + (name === isActive ? " active" : "" )}>
<CardActions>
<Button
name={name}
className={style.button}
size="small"
onClick={(event) => dispatch(getMethod(event.currentTarget.getAttribute("name")))}
>
<CardContent>
<Typography variant="h5" component="h2">
{title}
</Typography>
<Typography color="textSecondary">
{description}
</Typography>
</CardContent>
</Button>
</CardActions>
</Card>
);
}