Skip to content

Instantly share code, notes, and snippets.

@dance2die
Last active November 6, 2018 23:43
Show Gist options
  • Select an option

  • Save dance2die/22913120840120043c2e13bad5b8c4f0 to your computer and use it in GitHub Desktop.

Select an option

Save dance2die/22913120840120043c2e13bad5b8c4f0 to your computer and use it in GitHub Desktop.
const DownshiftContext = React.createContext();
export default () => (
<Downshift
onChange={selection => alert(`You selected ${selection.value}`)}
itemToString={item => (item ? item.value : "")}
>
{downshift => (
<DownshiftContext.Provider value={downshift}>
<h2>Basic Example</h2>
<div>
<Basic {...downshift.getRootProps({ refKey: "innerRef" })} />
</div>
</DownshiftContext.Provider>
)}
</Downshift>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment