I don't find the way ton fix my issue. I want a specific state if the route is '/blablabla/:id'. I know how to find the simple route as '/blabla'. With a if statement is ok but i need to use switch case. Thanks for your help
useEffect(() => {
switch (location.pathname) {
case '/':
setTitle('My Board');
break;
case '/offers':
setTitle('My Offer');
break;
case '/invoice':
setTitle('Invoices');
break;
case location.pathname.match(/\d+$/): -- The route is /invoice/:id --> the id is a number
setTitle('Invoice Number ***');
break;
default:
setTitle('My Board');
}
}, [location]);