Skip to content

Instantly share code, notes, and snippets.

@koss-lebedev koss-lebedev/App.tsx
Created Nov 17, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.