Skip to content

Instantly share code, notes, and snippets.

@christiannwamba
Created May 26, 2018 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannwamba/4d9fd2ec015a5b76978b144bbdca65f7 to your computer and use it in GitHub Desktop.
Save christiannwamba/4d9fd2ec015a5b76978b144bbdca65f7 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
constructor(props){
super(props);
this.state = {
number : 0
}
}
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<h1 className="App-title">Welcome to React</h1>
</header>
<p className="App-intro">
Does the state persist now? The value is {this.state.number}
</p>
<button onClick={()=>this.setState({number : this.state.number + 1})}>+</button>
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment