Guest User

Untitled

a guest
Feb 13th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import React, { Component } from 'react';
  2.  
  3. class Komponentas extends Component {
  4. constructor(props) {
  5. super(props);
  6.  
  7. // mini duombaze
  8. this.state = {
  9. data: 'informacija'
  10. }
  11. }
  12.  
  13. handleClick = () => {
  14. //siunciame duomenis
  15. this.setState({ data: 'pakeista info' });
  16. }
  17.  
  18. render() {
  19. // gauname duomenis
  20. const info = this.state.data;
  21. return (
  22. <div>
  23. <p>{info}</p>
  24. <button onClick={() => this.handleClick}>Push the button</button>
  25. </div>
  26. );
  27. }
  28. }
Add Comment
Please, Sign In to add comment