Skip to content

Instantly share code, notes, and snippets.

@leslie-alldridge
Created September 15, 2018 04:39
Show Gist options
  • Save leslie-alldridge/75b55aa6dad020797871559c7d0380ba to your computer and use it in GitHub Desktop.
Save leslie-alldridge/75b55aa6dad020797871559c7d0380ba to your computer and use it in GitHub Desktop.
toggle field react
addInventory (viewListID) {
console.log('hit');
this.setState(prevState => ({
viewListID: prevState.viewListID == viewListID ? null : viewListID
}));
}
{this.state.viewListID == bag.id && <BagList key={bag.id} id = {bag.id} description={bag.description} destination={bag.destination}/>}
this.state = {
bags: this.props.bags || [],
viewList: false,
viewListID: null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment