Skip to content

Instantly share code, notes, and snippets.

@alejovdev
Last active November 26, 2019 02:49
Show Gist options
  • Save alejovdev/335aa215d39abb55f4d58f7ba219a72d to your computer and use it in GitHub Desktop.
Save alejovdev/335aa215d39abb55f4d58f7ba219a72d to your computer and use it in GitHub Desktop.
function Todos({}) {
// Create the state
const [_todos, setTodos] = useState(0);
return (
<div className="todos">
<Helmet>
{/* Display the state as string */}
<title>MyApp | Todos {_todos.toString()}</title>
</Helmet>
<h1>Todos</h1>
{/* Add one each click */}
<button onClick={() => setTodos(_todos + 1)}>Add todo</button>
<Link to="/config">Config</Link>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment