Skip to content

Instantly share code, notes, and snippets.

@dstarr
Last active February 23, 2018 14:55
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 dstarr/57d88c4b2e0b746e50117822b11729bc to your computer and use it in GitHub Desktop.
Save dstarr/57d88c4b2e0b746e50117822b11729bc to your computer and use it in GitHub Desktop.
import React from 'react';
import PropTypes from 'prop-types';
const ColorSwatch = (props) => {
let style = {
backgroundColor: props.color,
};
return (
<div style={style}>
<h2>{props.text}</h2>
<p>
Lorem ...
</p>
</div>
);
};
ColorSwatch.PropTypes = {
color: PropTypes.string.isRequired,
text: PropTypes.string.isRequired
};
export default ColorSwatch;
@brodybits
Copy link

Why not use const style = { ... }?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment