Class components in react take two interfaces namely for props
and state
Class MyComponent extends React.Component<IMyComponentProps, IMyComponentState> {}
However while using hooks the component declaration looks like this
interface IMyComponentProps {
...
}
const MyComponent: React.FC<IMyComponentProps> = ({...}) => {
const [state, setState] = useState(...);
return (
<>...</>
);
};
export default FormMessage;
Is it necessary to specify interface for state
while using hooks and how?