Skip to content

Instantly share code, notes, and snippets.

@jordangarcia
Created January 31, 2020 01:05
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 jordangarcia/bc851b06d00b8d9925dc613d81cdd79f to your computer and use it in GitHub Desktop.
Save jordangarcia/bc851b06d00b8d9925dc613d81cdd79f to your computer and use it in GitHub Desktop.
import React, { useEffect, useState } from "react";
import { Flex, Title, Button } from "../../design/components";
import { Link } from "react-router-dom";
export default function Michael(props) {
const [greeting, setGreeting] = useState("initialValue");
useEffect(() => {
alert("greeting changed");
}, [greeting]);
return (
<Flex
width="100%"
height="100vh"
alignItems="center"
justifyContent="center"
>
<div>
<Title size={1}>hello {greeting}</Title>
<Button
onClick={() => {
setGreeting("jordan");
}}
mb={3}
>
change greeting
</Button>
<Link to="/">
<Button variant="outline-error">leave page</Button>
</Link>
</div>
</Flex>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment