styled components

Created: 2019 Dec 11th

Updated: 2019 Dec 11th

Edit this page on GitHub

conditionally use a style

<StyledButton
	active={true}
	onClick={this.handleButton}
></StyledButton>

And in your styles something like this:

const StyledButton = styled.button`
	align-items: center;
	line-height: 0.2;

	${({ active }) =>
		active &&
		`
    background: blue;
  `}
`
Scott avatar

Made with ❤️ by Scott Spence

Copyright © 2024 - All right reserved