The error:
TypeError: Object(...) is not a function
13 | import { connect } from 'react-redux';
14 |
15 |
> 16 | const useStyles = makeStyles(theme => ({
17 | ...theme
18 | }));
19 |
Code:
const useStyles = makeStyles(theme => ({
...theme
}));
Why do I get the above error?
Everything was working but suddenly i got that error, may be after i updated npm npm -g update but i am not sure.
Can someone help out?
Edit: this is how i am using useStyles:
const classes = useStyles();
then i am using the classes to style my elements like this:
<Button className={classes.button} />
classes.button get the button rule from the global theme and use it to style the button
useStylesis being utilized...classesvariable after declaring it? e.g.classes.input; Are you able to include that too?const theme = createMuiTheme({...}). Where you defined a theme, right?import { makeStyles } from '@material-ui/core/styles';(Re-export with a default theme) vsimport { makeStyles } from '@material-ui/styles';(Original module with no default theme). Was that the issue? Because one of those comes with your theme while the other doesn't...import { makeStyles} from '@material-ui/core/styles/makeStyles