Skip to content

Instantly share code, notes, and snippets.

@whichsteveyp
Created June 5, 2016 20:30
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 whichsteveyp/14c4ab4bd35bdb56025fbce5caa4b22a to your computer and use it in GitHub Desktop.
Save whichsteveyp/14c4ab4bd35bdb56025fbce5caa4b22a to your computer and use it in GitHub Desktop.
import B from './ComponentB-map.jsx';
export default const A = React.creatClass({
render() {
const { wrapperStyle, BStyleMap } = this.props.style;
// now you have to grok A's map, as well as B's map _and_ hope B has a map that supports the
// customization that you would want B to support when in this A context
return (
<div style={wrapperStyle}>
<B style={BStyleMap} />
</div>
);
}
});
export default const B = React.creatClass({
render() {
// now you have to grok the internals of this map to customize it
const { wrapperStyle, textStyle } = this.props.style;
return (
<div style={wrapperStyle}>
<p style={textStyle}>Hello!</p>
</div>
);
}
});
export default const B = React.creatClass({
render() {
// unfortunately you can't 'customize' the <p> text in this component
return (
<div style={this.props.style}>
<p style={{ color: red }}>Hello!</p>
</div>
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment