I'm getting an invalid hook call error when I run my app in the browser. The error appears when I use makeStyles in my app ( I checked by removing it and the error goes away). Can someone help me find out what I'm doing wrong? Here is my code:
import React, { useState} from 'react';
import { makeStyles } from '@material-ui/core/styles';
const useStyles = makeStyles({
header: {
background: '#C4C4C4',
textAlign: 'center',
boxShadow: '0px 2px 2px #A9A9A9',
fontFamily: 'PT Sans Caption',
fontSize: '36px',
marginBottom: '20px',
paddingTop: '20px',
textTransform: 'uppercase',
position: 'fixed',
top: 0,
width: '100%',
display: 'flex',
justifyContent: 'space-between',
},
});
const Header = (props) => {
const classes = useStyles();
const [ title ] = useState(props.title)
return (
<div className={classes.header}>{title}</div>
);
};
export default Header;
Any help would be great!