Skip to content

Commit

Permalink
docs(onChange): Update docs to mention onChange can be called with nu…
Browse files Browse the repository at this point in the history
…ll when selection is cleared (#721)

Closes #719
  • Loading branch information
TLadd authored and Silviu Alexandru Avram committed Jun 28, 2019
1 parent 7dc7a5b commit 8d94bc1
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 8d94bc1

Please sign in to comment.