【发布时间】:2021-06-02 11:40:24
【问题描述】:
如何解决这个错误:
“从不”类型上不存在属性“标签”
<Picker
dropdownIconColor='black'
mode="dropdown">
{stateList.map(option => <Picker.Item label={option.label} key={option.key} value={option.value} />)}
</Picker>
【问题讨论】:
-
stateList在哪里声明?它有什么类型? -
const [stateList, setStateList] = useState([]); -
Typescript 认为它是一个 Array
,如果你很懒,你需要输入它或使用 type Array -
我应该怎么写?你能告诉我正确的方法吗?
-
const [stateList, setStateList] = useState<Array<any>>([])基本上
标签: javascript reactjs typescript react-native