Skip to content

Instantly share code, notes, and snippets.

@cnocon
Created September 1, 2020 22:41
Show Gist options
  • Save cnocon/6d98b1eaaa4f6c0fd6f9a5c0df0b30e5 to your computer and use it in GitHub Desktop.
Save cnocon/6d98b1eaaa4f6c0fd6f9a5c0df0b30e5 to your computer and use it in GitHub Desktop.
import React, { useState } from 'react';
function App() {
const [ score, setScore ] = useState(0);
const [ message, setMessage ] = useState('Welcome!');
return (
<div className="App">
<header className="App-header">
<h1>{ message }</h1>
<h2>{ score }</h2>
<button onClick={() => setScore(prevScore => prevScore + 1)}>
Increase score
</button>
</header>
</div>
)
};
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment