Skip to content

Instantly share code, notes, and snippets.

@adeelibr
Last active April 16, 2019 19:03
Show Gist options
  • Select an option

  • Save adeelibr/7f757d3d107e97c28cf8524bc4dd91a0 to your computer and use it in GitHub Desktop.

Select an option

Save adeelibr/7f757d3d107e97c28cf8524bc4dd91a0 to your computer and use it in GitHub Desktop.
If/else hell & it's atonement Part I
const MyButton = ({ theme, content }) => {
let className = '';
if (theme === 'default') {
className = 'default-btn';
} else if (theme === 'primary') {
className = '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