I use React with typescript and react-bootstrap to create dropdown list:
ipc__handleSelect = (eventKey: any, event: any) => {
}
render() {
return (
<Dropdown>
<Dropdown.Toggle>Text</Dropdown.Toggle>
<Dropdown.Menu>
<Dropdown.Item
key = 'key1'
eventKey = 'key1'
onSelect = {this.ipc__handleSelect}
>Item</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
);
}
help identify data types
event: any- what type should I write?eventKey: any- what type should I write?
when I write eventKey: string (because the key is a string), I get error:
Type '(eventKey: string, event: any) => void' is not assignable to type 'SelectCallback'. Types of parameters 'eventKey' and 'eventKey' are incompatible. Type 'string | null' is not assignable to type 'string'. Type 'null' is not assignable to type 'string'.
why does null even occur there?