Skip to content

Instantly share code, notes, and snippets.

@alejovdev
Created December 8, 2019 05:39
Show Gist options
  • Save alejovdev/91ce2a7dfd77340263c6cd8dd2da08f7 to your computer and use it in GitHub Desktop.
Save alejovdev/91ce2a7dfd77340263c6cd8dd2da08f7 to your computer and use it in GitHub Desktop.
import React, { useState } from 'react'
import './App.css'
function App() {
const [views, setViews] = useState(0)
return (
<div>
<h1>Live counter</h1>
<h2>{views}</h2>
<button onClick={e => setViews(views + 1)}>Add view</button>
</div>
)
}
export default App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment