我有一个父功能组件:
function testing() {
const columns = [{ name: 'test1' },{ name: 'test2' }];
const data = [{ data: 'data1' }];
return (
<Table columns={columns} data={data} title='Test' />
)
}
调用子类组件:
class Table extends React.Component {
render() {
const columns = this.props.columns;
const data = this.props.data;
const title = this.props.title;
}
}
现在this.props
是空对象。
在这种情况下如何使用道具?