简体   繁体   中英

typescript: Property 'label' does not exist on type 'never'

How can fix this error:

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>

The useState hook is used as follows in Typescript:

//react javascript
const [wearablesList, setWearablesList] = useState([]);

//react typescript
interface Provider {
  connected: boolean;
  type: string;
}
const [wearablesList, setWearablesList] = useState<Provider[]>([]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM