Closed wangduanduan closed 5 years ago
By default, all React.Components have a this.props type of {}, which we saw in the & statement in the error. Since we really do want to have a fieldName prop, we have to add it:
interface Props {
fieldName: string;
}
interface State {
error: string | null;
}
class CustomInput extends React.Component<Props, State> {
state = {
error: null;
};
}
Property 'name' does not exist on type 'Readonly<{}> & Readonly<{ children?: ReactNode; }>'. TS2339