score:2

Accepted answer

solution i used

i created a function to test if the previous data is the same as the changed data.

compareparams(prevprops, props) {
    if (!prevprops || typeof prevprops.params !== typeof props.params) {
        return false;
    }
    return object.is(props.params, prevprops.params);
}

so this tests

  • are there any previous props?
  • and then if the props are equal to the previous props?
  • then return false if there are if this is the case
  • if not then we see compare props and previous props parameters

in componentdidupdate

in the compoonentdidupdate we use this function to determine if the data should be updated

componentdidupdate(prevprops) {
    if (this.compareparams(prevprops, this.props)) {
        return;
    }
    this.props[this.constructor.reducername](this.props.params);
}

conclusion

this code updates the body of a page that uses the same react component if it receives new data.

score:0

maybe you can try use onchange event on route component, check route api and then signal to child component that refresh is needed...


Related Query

More Query from same tag