import React from 'react';
import { useLocation } from 'react-router-dom'; // Assuming you are using React Router
const DetailTitle = () => {
const { pathname } = useLocation();
return (
<div>
{pathname === '/pageA && <h1>This is page A detail title</h1>}
{pathname === '/pageB' && <h1>This is page B detail title</h1>}
</div>
);
};
export default DetailTitle;