Created
June 5, 2016 20:30
-
-
Save whichsteveyp/14c4ab4bd35bdb56025fbce5caa4b22a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | |
); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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