score:1

Accepted answer
componentDidUpdate(prevProps) {
    if (prevProps.match.params.id === this.props.match.params.id) {
        // no need to do anything since we're still on the same ID
        return;
    }

    // perform the rest of your fetching logic
}

Related Query

More Query from same tag