Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import React from "react";
  2. import ReactDOM from "react-dom";
  3. class App extends React.Component {
  4.  
  5. constructor(){
  6. super();
  7. this.state = {text: "click to change"};
  8.  
  9.  
  10. }
  11.  
  12. ouch = () => {
  13. this.setState({text: "woot"});
  14. }
  15.  
  16.  
  17. render() {
  18. return <div>
  19. <p>{this.state.text}</p>
  20. <button onClick={this.ouch}>Yo</button>
  21. </div>
  22. }
  23.  
  24. }
  25. var app = document.getElementById('app');
  26. ReactDOM.render(<App />, app);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement