`tsx
function CtaSection() {
// Get location and pathname
const location = useLocation();
const pathname = createMemo(() => location.pathname);
// Constant to check if the CTA section can be rendered.
const canRenderCta = createMemo(
() => !EXCLUDED_PATHS_TO_SHOW_CTA.includes(pathname()),
);
// If the CTA section can't be render, return `null` to prevent the render and the request.
if (!canRenderCta()) {
return null;
}
// Request CTA data
const cta = createAsync(() => getCtaSettings());
return (...)
}
`tsx
function CtaSection() {
// Get location and pathname
const location = useLocation();
const pathname = createMemo(() => location.pathname);
// Constant to check if the CTA section can be rendered.
const canRenderCta = createMemo(
() => !EXCLUDED_PATHS_TO_SHOW_CTA.includes(pathname()),
);
// If the CTA section can't be render, return `null` to prevent the render and the request.
if (!canRenderCta()) {
return null;
}
// Request CTA data
const cta = createAsync(() => getCtaSettings());
return (...)
}