score:1

Accepted answer

your item_id is set only one time and it is not changing at all. on first time when component load it will work but when you are doing second time you are passing new item id but component is not aware about this change hence not able to do anything.

try to create a function which fetch data. same function call it in componentdidmount. now when it is getting new props it is time to check . use componentdidupdate.

componentdidupdate(prevprops, prevstate){ 
   if(prevprops.blogid != this.props.blogid){
        this.setstate({
           item_id: this.props.blogid 
       }, () => { call the function to get the data } )
  }
}

Related Query

More Query from same tag