I am using React Router Dom version 5.2.0. The website URL has been successfully changed but the page is not automatically refreshed.
Following is my code:
import React from "react";
import "./home.scss";
import { BlogItem, Button, Gap } from "../../components";
import { useHistory } from "react-router-dom";
const Home = () => {
const history = useHistory();
return (
<div className="home-page-wrapper">
<div className="create-wrapper">
<Button
tittle="create blog"
onClick={() => history.push("/create-blog")}
/>
</div>
<Gap height={20} />
<div className="content-wrapper">
<BlogItem />
<BlogItem />
<BlogItem />
<BlogItem />
</div>
<div className="pagination">
<Button tittle="Previous" />
<Gap width={20} />
<Button tittle="Next" />
</div>
<Gap height={20} />
</div>
);
};
export default Home;
I hope the website can move pages according to its function, and the website can refresh automatically when the url is changed.