Skip to content

Instantly share code, notes, and snippets.

@koss-lebedev
Created November 17, 2019 13:44
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 koss-lebedev/9c6c42505d4a41ea69c9acc1da16e988 to your computer and use it in GitHub Desktop.
Save koss-lebedev/9c6c42505d4a41ea69c9acc1da16e988 to your computer and use it in GitHub Desktop.
import React from "react"
import { useSpring, animated } from "react-spring"
const App = () => {
const [isExpanded, setExpanded] = React.useState(false);
const style = useSpring({
width: isExpanded ? "100vw" : "200px",
height: isExpanded ? "100vh" : "200px",
borderRadius: isExpanded ? "0px" : "10px",
});
return (
<animated.div
className="box"
style={style}
onClick={() => setExpanded(!isExpanded)}
>
I am a box
</animated.div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment