key is not available as prop in the Child component in ReactJs

前端 未结 2 1915
南旧
南旧 2021-01-13 06:13

I have a parent component in which below component is producing dynamically in map function as below:

const renderListing = this.props.listi         


        
2条回答
  •  有刺的猬
    2021-01-13 06:51

    'key' and 'ref' are reserved words that are not allowed to be passed as props. You can pass another prop with the same value

    const renderListing = this.props.listing.map(function(list, index) {
        return (
              );
      }, this);
    

    and use it like

    
    

提交回复
热议问题