Skip to content

Instantly share code, notes, and snippets.

@adeelibr
Last active April 16, 2019 19:06
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 adeelibr/211d5374e643bfe9d6bf13a80b58c5d9 to your computer and use it in GitHub Desktop.
Save adeelibr/211d5374e643bfe9d6bf13a80b58c5d9 to your computer and use it in GitHub Desktop.
If/else hell & it's atonement Part 2
const MyButton = ({ theme, rounded, content }) => {
let className = '';
if (theme === 'default') {
className = rounded ? 'default-btn rounded' : 'default-btn';
} else if (theme === 'primary') {
className = rounded ? 'primary-btn rounded' : 'primary-btn';
}
return (
<button className={className}>{content}</button>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment