Exercise 1: What the Rewrite Rule Actually Does — Possible Solution ==================================================================== WHAT THE REWRITE RULE DOES ------------------------------ The rewrites block in firebase.json tells Firebase Hosting to serve index.html for any request path that doesn't match an actual static file, rather than returning a 404 for paths Hosting itself doesn't recognize. Since a single-page React app only has one real HTML file, every other "page" (like /history or /scan) only exists because React Router, running inside that same index.html, interprets the URL client-side and renders the matching view. WHAT BREAKS WITHOUT IT ------------------------------ Without the rewrite rule, Hosting has no file at /history or /scan to serve at all - navigating there directly, or refreshing the page while on one of those routes, returns a genuine 404 from Hosting itself, before React Router ever gets a chance to run. The app would work fine as long as a user only ever clicked links from within the already-loaded app, but would appear completely broken the moment someone bookmarked a route, shared a direct link, or simply refreshed the page. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains that the rewrite rule redirects unmatched paths to index.html so client-side routing can take over, and correctly describes the specific failure mode (a 404 on direct navigation or refresh to any non-root route) that results without it.