Guest User

Untitled

a guest
Apr 20th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. // set initial states for as many variables as needed
  2. state = {
  3. shown_first_index: null,
  4. shown_second_index: null,
  5. }
  6.  
  7. /* change variables with setState.
  8. Here, shown_second_index gets the value of shown_first_index and shown_first_index gets a new value.
  9. Note: when setState is finished it calls the render function again */
  10. handle_select = (id) => {
  11. this.setState({
  12. shown_first_index: id,
  13. shown_second_index: this.state.shown_first_index,
  14. })
  15. }
Add Comment
Please, Sign In to add comment