Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Created July 23, 2020 12:22
Show Gist options
  • Save treyhuffine/00280335b5687ab399f9e68912e42c62 to your computer and use it in GitHub Desktop.
Save treyhuffine/00280335b5687ab399f9e68912e42c62 to your computer and use it in GitHub Desktop.
import './styles.css';
const ClassStylesComponent = () => {
const [isActive, setIsActive] = useState(false);
const className = isActive ? 'button--active' : 'button';
return (
<div>
<button onClick={() => setIsActive(!isActive)} className={className}>
click me
</button>
</div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment