Skip to content

Commit

Permalink
Wrapping components
Browse files Browse the repository at this point in the history
  • Loading branch information
vasanthk committed Mar 26, 2017
1 parent ed34fa4 commit c37e838
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ux-variations/05.wrapper-components.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* Using Wrappers to handle UX/style variations
*
* For Handling Wrapper <div>’s and other markup around component, use composition!
*
* When you create a React component instance, you can include additional React components or JavaScript expressions between the opening and closing tags.
* Parent can read its children by accessing the special this.props.children prop.
*
* @Reference:
* https://speakerdeck.com/vasa/building-multitenant-ui-with-react-dot-js
*/

const SampleComponent = () => {
<Parent>
<Child />
</Parent>
};

const Parent = () => {
// You can use class 'bla' or any other classed to handle any style variations for the same markup.
<div className="bla">
{this.props.children}
</div>
};

0 comments on commit c37e838

Please sign in to comment.