如何在组件中设置此状态的类型
state: any = {
profile: {
details: any: {
name: any: '',
email: any: '',
age: any: '',
cellNumber: any: '',
}
}
}
class NewNoteForm extends Component<props> {
static defaultProps = {profileStore:{}}
state = {
profile: {
details: {
name: '',
email: '',
age: '',
cellNumber: '',
}
}
}
}
interface IDetails
{
name: string;
email: string;
age: number;
cellNumber: number;
}
interface IProfile
{
details: IDetails;
}
答案 0 :(得分:2)
您可以为状态定义一个接口,并在定义类时使用它。
示例
ERROR_INVALID_PARAMETER (87 / 0x57)