[英]typescript: Property 'label' does not exist on type 'never'
如何修復此錯誤:
“從不”類型上不存在屬性“標簽”
<Picker
dropdownIconColor='black'
mode="dropdown">
{stateList.map(option => <Picker.Item label={option.label} key={option.key} value={option.value} />)}
</Picker>
useState 鈎子在 Typescript 中使用如下:
//react javascript
const [wearablesList, setWearablesList] = useState([]);
//react typescript
interface Provider {
connected: boolean;
type: string;
}
const [wearablesList, setWearablesList] = useState<Provider[]>([]);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.