When clicking the button
component Aaaaaa
is not re-rendered, but when tapping on the Link
component Aaaaaa
is re-rendered.
What could be causing this behavior?
function App() {
return (
<>
<button onClick={() => window.history.pushState('','','/about')}>About</button>
<Link to='/about'>to About</Link>
<Aaaaaa/>
</>
);
}
and:
Aaaaaa(){
const location = useLocation()
return <div>About </div>
}
When clicking the button
, component Aaaaaa
is not re-rendered. However, when tapping on the Link
, component Aaaaaa
is re-rendered.
What could be causing this behavior?