forked from vasanthk/react-bits
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
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
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> | ||
}; |