[英]Why am I getting warning for functions as a React Child on this
what am I missing?我错过了什么? I cant spot it and my grids are not rendering properly.
我无法发现它,我的网格没有正确渲染。 I am getting warnings about functions not valid as a React Child.
我收到有关作为 React Child 无效的函数的警告。
render() {
return (
<ModalDynamic
defaultWidth={1200}
defaultHeight={400}
defaultX={100}
defaultY={100}
display={this.props.showPartsModal}
title={
"Parts for Invoice: " +
(this.props.selectedHistory[0] !== undefined
? this.props.selectedHistory[0].invoice_number
: "N/A")
}
dealerPath="[ 12345 ] Some Dealer"
dismissAction={this.props.dismissAction}
>
<div
//className="ag-theme-bootstrap container-fluid full-height zero-gap modal-container"
className="ag-fresh container-fluid full-height zero-gap modal-container"
style={{
height: "calc(100%)",
overflowX: "auto"
}}
id="viewPartsGrid"
>
<AgGridReact
columnDefs={this.state.columns}
rowData={this.props.selectedHistory}
suppressMenuHide="true"
suppressRowClickSelection="false"
suppressColumnVirtualisation="false"
sideBar="false"
rowSelection="single"
enableColResize="true"
enableSorting="true"
enableFilter="true"
onGridReady={this.onGridReady}
/>
</div>
<div className="rnd-footer">
<div className="rnd-left">{this.dealerLabel}</div>
<div className="rnd-right">
{this.state.gridAPI ? (
<OverlayTrigger overlay={this.csvTip}>
<Button
className="btn btn-primary btn-sm"
onClick={() =>
this.state.gridAPI.exportDataAsCsv({
fileName:
"Parts Invoice #" +
(this.props.selectedHistory[0].invoice_number
? this.props.selectedHistory[0].invoice_number
: "N/A")
})
}
>
<i className="fa fa-file-excel-o" />
</Button>
</OverlayTrigger>
) : null}
</div>
</div>
</ModalDynamic>
);
}
}
The code compiles but the grid seems to not do what I am trying to write it to do.代码编译但网格似乎没有做我试图编写它做的事情。 Columns are not resizable and the window itself isn't either.
列不能调整大小,窗口本身也不能。
I think this line may give you warning我认为这条线可能会给你警告
<div className="rnd-left">{this.dealerLabel}</div>
If this is a function that return some static value.如果这是一个返回一些静态值的函数。 Declare that in a new variable
在新变量中声明
Example in render渲染示例
const Button = <button onClick={this.yourmethod}>Click Me</button>
return (
<Button>
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.