I am trying to render a specific Layout if the location change and I'm using the useMemo hook to validate the route and render the based on this value but it always returns true even the route change for example the new route is .../SSDSD/draft
const location = useLocation();
console.log(location)
const showShadow = useMemo(() => ['preview', 'signing', 'receipts'].some(word => location.pathname.includes(word)), [location]);
const isHomePage = useMemo(() => ['/', '/search', '/addressbook'].some(word => location.pathname.includes(word)), [location]);
console.log(isHomePage);
//debugger;
return (
<ThemeProvider theme={theme}>
<Box className={isHomePage ? classes.homeBackground : classes.innerBackground}>
</Box>
</ThemeProvider>
);
}