Performance: Single Page Application concept
MEDIUM IMPACT
This concept affects initial page load speed and interaction responsiveness by loading content dynamically without full page reloads.
import { useNavigate } from 'react-router-dom'; function LoadPage() { const navigate = useNavigate(); navigate('/about'); } // Or inside a component: // const navigate = useNavigate(); // navigate('/about');
function loadPage() { window.location.href = '/about'; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full page reload on navigation | High (reloads entire DOM) | Multiple (full reflow) | High (full repaint) | [X] Bad |
| Client-side routing with React Router | Low (updates part of DOM) | Single or none | Low (partial repaint) | [OK] Good |
| Loading entire app bundle upfront | N/A | N/A | Blocks rendering during JS parse | [X] Bad |
| Code splitting with lazy loading | N/A | N/A | Non-blocking JS load | [OK] Good |