I'm using typescript and simply using a hook inside React.FC but I'm getting error saying I can only use hooks inside functional components. React.FC doens't count as a funcional component?
Here is what I'm doing
interface Props { }
export const Register: React.FC<Props> = () => {
const [test, setTest] = useState('')
return (
<div>
Register View
</div>
)
}
And the error
× Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app
This makes no sense, how is this possible? If I remove the line const [test, setTest] = useState(''), everything works normal.
