Skip to content

Instantly share code, notes, and snippets.

@pmarquees
Last active September 20, 2016 22:09
Show Gist options
  • Save pmarquees/5a697b4496877c9f6392b68340aee142 to your computer and use it in GitHub Desktop.
Save pmarquees/5a697b4496877c9f6392b68340aee142 to your computer and use it in GitHub Desktop.
import React from 'react'; // This imports the react library
import './styles.css' // In this case I chose to import the styles from a separate file
const Button = ({
type = 'default' // this is the parameter you'll be able to define in the HTML
cta = '',
children, // by defining children as a parameter you are making it available to be used inside the component
}) => (
<button className={`button-base ${type}`}>
<p>{cta || children}</p>
</button>
);
export default Button; // You need to export this component in order to make it available to be used in your application
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment