Skip to content

Commit

Permalink
chore: update readme using state hook
Browse files Browse the repository at this point in the history
  • Loading branch information
mrlaessig committed Oct 2, 2024
1 parent 9ee0c40 commit e153d85
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ $ yarn add react-native-autocomplete-input

```javascript
function MyComponent() {
const { query } = this.state;
const [ query, setQuery ] = useState('');
const data = filterData(query);

return (
<Autocomplete
data={data}
value={query}
onChangeText={(text) => this.setState({ query: text })}
onChangeText={(text) => setQuery(text)}
flatListProps={{
keyExtractor: (_, idx) => idx,
renderItem: ({ item }) => <Text>{item}</Text>,
Expand Down

0 comments on commit e153d85

Please sign in to comment.