Javascript 如何将道具传递给作为值传递的组件
下面是我的代码场景Javascript 如何将道具传递给作为值传递的组件,javascript,reactjs,react-props,Javascript,Reactjs,React Props,下面是我的代码场景 const components = { body: { row: EditableFormRow, cell: EditableCell, }, }; 我正在使用另一个组件中的组件,如下所示 <CustomTable columns={updatedcolumns} dataSource={dataSource} components={components} rowClassName={(
const components = {
body: {
row: EditableFormRow,
cell: EditableCell,
},
};
我正在使用另一个组件中的组件,如下所示
<CustomTable
columns={updatedcolumns}
dataSource={dataSource}
components={components}
rowClassName={() => 'editable-row'}
bordered
size="middle"
pagination={false}
// scroll={{ x: '130%', y: 240 }}
/>
“可编辑行”}
边界
size=“middle”
分页={false}
//滚动={x:'130%',y:240}
/>
我想将一个道具传递给EditableCell,它是另一个文件中定义的组件。
当我跟随它时,它会给我错误
const components = {
body: {
row: EditableFormRow,
cell: <EditableCell type="text"/>,
},
};
const组件={
正文:{
行:EditableFormRow,
单元格:,
},
};
我不知道如何传递道具。请提供帮助。您需要将组件包装到函数中:
cell: () => <EditableCell type="text"/>,
单元格:()=>,
您需要将组件包装到函数中:
cell: () => <EditableCell type="text"/>,
单元格:()=>,