Skip to content

Instantly share code, notes, and snippets.

@agustinfece
Last active January 19, 2021 13:37
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 agustinfece/f7e22eb7c90b546ce2124a647a5d8d6b to your computer and use it in GitHub Desktop.
Save agustinfece/f7e22eb7c90b546ce2124a647a5d8d6b to your computer and use it in GitHub Desktop.
App2.js
import logo from './logo.svg';
import './App.css';
import { useState } from 'react';
function App() {
const [text, setText] = useState('Click the button');
const onClickHandler = () => {
setText('Pressed!')
}
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
<p>{text}</p>
<button onClick={onClickHandler}>Click me!</button>
</header>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment