Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- class Komponentas extends Component {
- constructor(props) {
- super(props);
- // mini duombaze
- this.state = {
- data: 'informacija'
- }
- }
- handleClick = () => {
- //siunciame duomenis
- this.setState({ data: 'pakeista info' });
- }
- render() {
- // gauname duomenis
- const info = this.state.data;
- return (
- <div>
- <p>{info}</p>
- <button onClick={() => this.handleClick}>Push the button</button>
- </div>
- );
- }
- }
Add Comment
Please, Sign In to add comment