Hello. I am trying to display data from different url through one component. Data is output, but when the url is changed, it is taken from the original request. componentDidMount (see code below) only works when the component is first rendered. I ask for your help. It is necessary that the component is rendered every time anew with new data when its dynamic url changes.
<Route path="/animals/:type/:advertisment" component={AnimalCard} /> componentDidMount() { let animal_type = this.props.params.type; let advertisment = this.props.params.advertisment; $.ajax({ url: "http://localhost:8091/list-animals?animal_type=" + animal_type + "&advertisement_type=" + advertisment, dataType: "json", success: (data) => { //здесь в Redux Store отправляются полученные данные this.props.getServerData(data); console.log("ele" + animal_type, advertisment); } }) }