Reactjs 渲染PieChart时出现未知道具警告

Reactjs 渲染PieChart时出现未知道具警告,reactjs,recharts,Reactjs,Recharts,当我试图用内容呈现图例组件时,我遇到了这个错误 警告:36警告:未知道具垂直对齐,布局,对齐,图标类型,图标大小,有效载荷,图表宽度,图表高度,边距,标签上的onBBoxUpdate 这是获取多个内容的图例代码 const renderContent = (content, props) => { if (React.isValidElement(content)) { return React.cloneElement(content, props); } else if

当我试图用内容呈现图例组件时,我遇到了这个错误

警告:36警告:未知道具
垂直对齐
布局
对齐
图标类型
图标大小
有效载荷
图表宽度
图表高度
边距
标签上的onBBoxUpdate

这是获取多个内容的图例代码

const renderContent = (content, props) => {
  if (React.isValidElement(content)) {
    return React.cloneElement(content, props);
  } else if (_.isFunction(content)) {
    return content(props);
  }

  return React.createElement(DefaultLegendContent, props);
};
这就是为什么,它会收到未知道具警告。因此,如何在子组件中删除这些父道具

 //Legend tag
    <Legend verticalAlign="middle" layout="vertical" align="right" iconType="circle" content={this._LegendWithValues()}

//Custom legend content
 _LegendWithValues = () => {
        return (
            <ul className="cui-legend-content">
                {
                    this.props.data.map((entry, index) => (
                        <li key={`item-${index}` }>
                            <svg height="20" width="20">
                                <circle cx="10" cy="10" r="5" strokeWidth="3" fill={this._getColorScheme()[index]}/>
                            </svg>
                            <text style={ul_style} >{entry.name}:{entry.unit} {entry.value}</text>
                        </li>
                    ))
                }
            </ul>
        );

    }
//图例标记
{
返回(
    { this.props.data.map((条目,索引)=>(
  • {entry.name}:{entry.unit}{entry.value}
  • )) }
); }
可能与克隆元素如何克隆道具有关?

您可以像上面的示例中那样提取不需要的道具