Created
July 23, 2020 12:21
-
-
Save treyhuffine/fbca5f1becb0eff61f75c7b871916c2a to your computer and use it in GitHub Desktop.
This file contains hidden or 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 styled from 'styled-components'; | |
const Button = styled.button` | |
background-color: ${({ isActive }) => (isActive ? 'green' : 'gray')}; | |
`; | |
const CssInJsComponent = () => { | |
const [isActive, setIsActive] = useState(false); | |
return ( | |
<div> | |
<Button onClick={() => setIsActive(!isActive)} isActive={isActive}> | |
click me | |
</Button> | |
</div> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment