Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 道具更改后,React组件不会重新渲染_Reactjs_React Redux_Antd - Fatal编程技术网

Reactjs 道具更改后,React组件不会重新渲染

Reactjs 道具更改后,React组件不会重新渲染,reactjs,react-redux,antd,Reactjs,React Redux,Antd,更新道具时,使用Ant Design Framework的React组件不会重新渲染。数据显示在控制台中已更新,但在列表标记中未更新。 这是我代码的一部分 render() { const props = this.props; data=[ { 'title':'name1', 'content':props.data.content1 }, { 'title':'name2', 'content':p

更新道具时,使用Ant Design Framework的React组件不会重新渲染。数据显示在控制台中已更新,但在列表标记中未更新。 这是我代码的一部分

   render() {
   const props = this.props;
   data=[
   {
       'title':'name1',
       'content':props.data.content1
   },
   {
       'title':'name2',
       'content':props.data.content2
   },
   ]
   console.log("Data..",data);
   return (
    <Page {...props}>
        <Helmet title="Organizations" />
        <div className="card">
           <div className="card-header">
             <div className="utils__title">
                <strong>Organization Details</strong>
              </div>
            </div>
      <div className="card-body" span={20}>
        <div className="organization">
          <div className="organization_details">
            <List
              grid={{ gutter: 16, column: 1 }}
              dataSource={data}
              size="small"
              renderItem={item => (
                <List.Item>
                  <Card className="list1" title={item.title} bordered={false}>
                    {item.content}
                  </Card>
                </List.Item>
              )}
            />
           </div>
         </div>
       </div>
      </div>
      </Page>
    )
render(){
const props=this.props;
资料=[
{
“标题”:“名称1”,
“内容”:props.data.content1
},
{
“标题”:“名称2”,
“内容”:props.data.content2
},
]
console.log(“数据..”,数据);
返回(
组织详细信息
(
{item.content}
)}
/>
)

}我认为数据这里不是您想要使用的数据变量

使用const就可以了

// Destructure your props like this
const { props } = this;

const data=[
   {
       'title':'name1',
       'content':props.data.content1
   },
   {
       'title':'name2',
       'content':props.data.content2
   },
]

我认为数据这里不是您想要使用的数据变量

使用const就可以了

// Destructure your props like this
const { props } = this;

const data=[
   {
       'title':'name1',
       'content':props.data.content1
   },
   {
       'title':'name2',
       'content':props.data.content2
   },
]

如何将道具传递给上面组件的渲染函数?将道具传递给此组件时,请使用标记的键属性。如何将道具传递给上面组件的渲染函数?将道具传递给此组件时,请使用标记的键属性