ラッパーコンポーネントをpropsとして渡そうとしています。このような何かが技術的にReactでは可能ですか?ReactJSでラッパーコンポーネントを渡す
import React, {Component, PropTypes} from 'react';
import ChildComp from './child-comp';
class Comp extends Component {
render() {
const { Wrapper } = this.props;
return (
<Wrapper>
<ChildComp />
</Wrapper>
);
}
}
Comp.propTypes = {};
export default Comp;
小道具プロキシ[高次成分(https://medium.com/@franleplant/react-higher-order-components-in-depth-cf9032ee6c3e#.aosc7lsuy)してもよいですあなたが探しているものになります。基本的には、コンポーネントを渡すラッピング関数です。 –
HOCドキュメント:http://stackoverflow.com/documentation/reactjs/1185/components/4649/creating-components#t=20161223100405611594 –