我正在试验 React.js,它运行得非常好。我想知道是否可以像这样将类注入到其他类中:
var Container = React.createClass({
render: function() {
<{this.props.implComponent}/>
}
});
假设 implComponent 已经像这样传递了:
React.render(
<Container implComponent="somePredefinedVariable" />,
document.getElementById('content')
);
由于语法错误,这不起作用。我很容易理解为什么。
换句话说,我想根据名称将类注入其他类。这可能吗?我怎样才能做到这一点?