Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // set initial states for as many variables as needed
- state = {
- shown_first_index: null,
- shown_second_index: null,
- }
- /* change variables with setState.
- Here, shown_second_index gets the value of shown_first_index and shown_first_index gets a new value.
- Note: when setState is finished it calls the render function again */
- handle_select = (id) => {
- this.setState({
- shown_first_index: id,
- shown_second_index: this.state.shown_first_index,
- })
- }
Add Comment
Please, Sign In to add comment