Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 756 Bytes

05.wrapper-components.md

File metadata and controls

26 lines (21 loc) · 756 Bytes

Wrapper Components

Using Wrappers to handle UX/style variations

For Handling Wrapper

’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:

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>
};