Skip to content

Commit

Permalink
Update docs to mention onChange can be called with null when selectio…
Browse files Browse the repository at this point in the history
…n is cleared

Closes downshift-js#719
  • Loading branch information
stackpathtladd2 committed Jun 28, 2019
1 parent 7dc7a5b commit 36d34d2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ const items = [

render(
<Downshift
onChange={selection => alert(`You selected ${selection.value}`)}
onChange={selection => alert(
selection ? `You selected ${selection.value}` : 'Selection Cleared'
)}
itemToString={item => (item ? item.value : '')}
>
{({
Expand Down Expand Up @@ -221,11 +223,9 @@ compute the `inputValue`).
> `function(selectedItem: any, stateAndHelpers: object)` | optional, no useful
> default
Called when the user selects an item and the selected item has changed. Called
with the item that was selected and the new state of `downshift`. (see
`onStateChange` for more info on `stateAndHelpers`).
Called when the selected item changes, either by the user selecting an item or the user clearing the selection. Called with the item that was selected or `null` and the new state of `downshift`. (see `onStateChange` for more info on `stateAndHelpers`).

- `selectedItem`: The item that was just selected
- `selectedItem`: The item that was just selected. `null` if the selection was cleared.
- `stateAndHelpers`: This is the same thing your `children` function is
called with (see [Children Function](#children-function))

Expand Down

0 comments on commit 36d34d2

Please sign in to comment.