Last active
January 31, 2020 15:15
-
-
Save emmabostian/dc959e98a55d03d91920c764b177f410 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
import { animated, useSpring, config } from "react-spring"; | |
import "./styles.css"; | |
export default function App() { | |
const [progress, setProgress] = useState("0%"); | |
const props = useSpring({ width: progress, config: config.slow }); | |
return ( | |
<div className="App"> | |
<div className="button-bar"> | |
<button onClick={() => setProgress("0%")}>0%</button> | |
<button onClick={() => setProgress("25%")}>25%</button> | |
<button onClick={() => setProgress("50")}>50%</button> | |
<button onClick={() => setProgress("75")}>75%</button> | |
<button onClick={() => setProgress("100")}>100%</button> | |
</div> | |
<div className="meter"> | |
<animated.span style={props} /> | |
</div> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment