Advertisement
Oslapas

Untitled

Jan 5th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. const list =["17","17","18","19","20","50","50"];
  2.  
  3.  
  4. class App extends React.Component {
  5.  
  6. constructor(){
  7. super();
  8.  
  9. this.state = {
  10. list: list
  11. };
  12. this.func = this.func.bind(this);
  13. }
  14.  
  15.  
  16. func (list) {
  17.  
  18.  
  19. this.setState({ list: 40 });
  20. }
  21.  
  22. render(){
  23.  
  24.  
  25.  
  26. return(
  27. <div>
  28. {list}
  29. <button onClick={()=> this.func(list)} type="button">Dismiss</button>
  30. <div> {list}</div>
  31. </div>
  32. )}
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement