In the GroupInfo component of my application, there is an useEffect that should trigger when the match from props change. But it does not. The code of the useEffect is as follows.
useEffect
(
() =>
{
try
{
const runEffect = async () =>
{
const _id = match.params.id;
const response = await api.get
(
"/groupidindex",
{
params:
{
_id
}
}
);
setGroup (response.data);
}
runEffect();
}
catch (error)
{
throw new Error (error);
}
},
[match]
)
And the piece of code where the link is set is the following.
<Link key = {index} to = {match.url.concat ("/"+group._id)}>
The declaration of the component in the App.js file is the following.
<Route path = "/groups/:id/:id" component = {GroupInfo}/>
The GroupInfo component does not render when the path meets the requirements, and does not re-render when the path changes. It renders/re-renders when I reload the page, however. I used an useEffect that changed on url change before, in another component of the same application, and it worked fine.