Skip to content

Instantly share code, notes, and snippets.

@surajitbasak109
Created February 10, 2020 20:25
Show Gist options
  • Save surajitbasak109/1dd2616b0f51a747e0e7c0c31ccab401 to your computer and use it in GitHub Desktop.
Save surajitbasak109/1dd2616b0f51a747e0e7c0c31ccab401 to your computer and use it in GitHub Desktop.
hanldeKeydown(evt) {
const { cursor, searchItems } = this.state;
// ... more code ...
if (evt.keyCode === 13) {
let currentItem = searchItems[cursor];
if (currentItem !== undefined) {
const { name, code, rate, unit } = currentItem;
this.setState({ item: { name, code, rate, unit }, searchItems: [] });
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment