SPA Routing Architecture
Understand the HashRouter implementation in the Customer SPA and why it's used.
WooNooW relies on a Hybrid by Default architecture with React SPA islands. To avoid conflicting with native WordPress rewrite rules and to provide a seamless frontend experience, the Customer SPA uses HashRouter instead of the traditional BrowserRouter.
Why HashRouter?
When a customer navigates the WooNooW Customer SPA (e.g., Shop, Cart, Checkout, or My Account), the routing happens entirely on the client side without triggering full page reloads or conflicting with WordPress.
URL Format:
How It Works
- WordPress Load: WordPress handles the initial request (e.g.,
/shop) and renders the SPA container. - React Takes Over: The React application reads the route after the
#(e.g.,#/product/product-slug) and renders the appropriate component. - No Conflicts: Anything after the hash
#is ignored by the server, ensuring zero 404 errors or conflicts with existing WordPress canonical redirects.
Benefits
- Zero Server Config: No complex
.htaccessor NGINX rewrite rules required. - Shareable Links: Hash routes can be shared in email campaigns or social media.
- Direct URL Access: Users can directly paste a URL or bookmark a page and the SPA will load perfectly.
Developer Rules
When building custom frontend extensions or working with the Customer SPA:
- Always use
HashRouterfor the Customer SPA. - Use React Router
Linkcomponents to ensure links automatically use hash URLs. - Never use
BrowserRouter, as it will cause immediate conflicts with WordPress routing. - Never try to override WordPress routes; rely on the hash for internal SPA navigation.
SEO Considerations
While HashRouter URLs are primarily for the SPA experience, WooCommerce product pages still exist in the background. Search engines index the actual product URLs, and canonical tags ensure SEO equity is maintained while providing the fast SPA experience to actual users.
Last updated Dec 12, 2025
