Reactjs 反应本机数据类型
我们是否可以使用react native确定变量的数据类型(字符串、整数、布尔值等) 例如:Reactjs 反应本机数据类型,reactjs,react-native,types,native,Reactjs,React Native,Types,Native,我们是否可以使用react native确定变量的数据类型(字符串、整数、布尔值等) 例如: class ex { years: integer; name: string; remember: boolean; } 我可以决定表单中的数据是字符串还是整数吗?是的,您可以使用typeof(您的变量名) 范例 输出 变量的类型为:string 是的,当然,您可以使用prop-types进行类型检查。我想指定不属于您缺少javascript标记的状态数据类型?这主要取决于语言,而不是框
class ex {
years: integer;
name: string;
remember: boolean;
}
我可以决定表单中的数据是字符串还是整数吗?是的,您可以使用
typeof(您的变量名)
范例
输出
变量的类型为:string
是的,当然,您可以使用
prop-types
进行类型检查。我想指定不属于您缺少javascript标记的状态数据类型?这主要取决于语言,而不是框架。我是纽宾,我不知道怎么做
var name="name here";
console.log("type of variable is:"+typeof(name));