diff --git a/README.md b/README.md index e78523da..bc70d092 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,23 @@ Accessible, extensible, Autocomplete for React.js. ```jsx item.label} + getItemValue={(item) => item.id} items={[ - { label: 'apple' }, - { label: 'banana' }, - { label: 'pear' } + { id: 'apple', label: 'apple' }, + { id: 'banana', label: 'banana' }, + { id: 'pear', label: 'pear' } ]} renderItem={(item, isHighlighted) => -
+
{item.label}
} - value={value} - onChange={(e) => value = e.target.value} - onSelect={(val) => value = val} + value={this.state.value} + onChange={e => this.setState({ value: e.target.value })} + onSelect={value => this.setState({ value })} /> ```