React.js: Wrapping one component into another

前端 未结 3 834
感动是毒
感动是毒 2020-12-04 05:17

Many template languages have \"slots\" or \"yield\" statements, that allow to do some sort of inversion of control to wrap one template inside of another.

Angular ha

3条回答
  •  我在风中等你
    2020-12-04 05:48

    Try:

    var Wrapper = React.createClass({
      render: function() {
        return (
          
    before {this.props.children} after
    ); } });

    See Multiple Components: Children and Type of the Children props in the docs for more info.

提交回复
热议问题