关于将父组件的所有props传递给子组件,在react15中可以用{...props}方式传递,但在react16中会报spread未定义,是有其他方式了吗?
const Show=props=>(
<div>{props.content}</div>
);
const App=props=>(
<Show {...props} />
);
ReactDOM.render(<App content={'test'} />,document.body);
...
是ES6
中的解构运算,与React
的版本没有关系。所以从其他地方入手解决。