Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. changeActive = () => {
  2. const { students } = this.state;
  3. if (students.active === true) {
  4. let studentCopy = JSON.parse(JSON.stringify(this.state.student));
  5. studentCopy[0].active = false;
  6. this.setState({
  7. student: studentCopy
  8. });
  9. } else {
  10. let studentCopy = JSON.parse(JSON.stringify(this.state.student));
  11. studentCopy[0].active = true;
  12. this.setState({
  13. student: studentCopy
  14. });
  15. }
  16. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement