I really don't understand what am I doing wrong.
I am using the makeStyles
hook as described inside the (javascript) documentation, and I am getting this Invalid Hook Call
. I am using TypeScript 4.1.2, React 17.0.1 and React Types 17.0.0.
Here is the component code:
import React from 'react';
import { Theme, makeStyles } from '@material-ui/core/styles';
interface Props
{
isVisible: boolean;
}
const useStyles = makeStyles( ( theme: Theme ) => ( {
root: {
background: 'red',
height: 100,
},
} ) );
const Nav: React.FC<Props> = ( props: Props ) =>
{
const { isVisible } = props;
const classes = useStyles( {} );
return (
<div className={classes.root}>
</div>
);
};
export default Nav;