Categories
React

Refresh/Reload Page

  1. Reload
  2. Refresh
  3. Refs

Reload

// react-router V6
import { useNavigate } from "react-router-dom";

const navigate = useNavigate();

const refreshPage = () => {
    navigate(0);
}

Refresh

// React re-create the actual page every time the location key changes

export const Page = () => {
   const location = useLocation();
   return <PageImpl key={location.key} />
}

history.push(/this-page-route)

Refs

Refresh method

Leave a comment