import React from 'react'; import { Router, Routes, Route, Link, useNavigate, useLocation, useParams, WebFRouterLink } from '@openwebf/react-router'; // Navigation component that appears on all pages function Navigation() { const location = useLocation(); return ( ); } // Home component function Home() { const navigate = useNavigate(); const handleNavigate = () => { navigate('/about', { state: { from: 'home' } }); }; return (

Home

Welcome to the home page!

); } // About component function About() { const location = useLocation(); return (

About

This is the about page.

{location.state?.from && (

You came from: {location.state.from}

)}
); } // User profile component function UserProfile() { const { id } = useParams<{ id: string }>(); return (

User Profile

User ID: {id}

); } // Users component function Users() { return (

Users

{/* Note: Nested routes in WebF need separate WebFRouterLink elements */}
); } // Contact component function Contact() { const navigate = useNavigate(); const handleReplace = () => { navigate('/', { replace: true }); }; return (

Contact

Contact us at: example@email.com

); } // Not Found component function NotFound() { return (

404 - Not Found

The page you're looking for doesn't exist.

Go back to Home
); } // Main App component - WebF pattern export default function AppWebFPattern() { return ( } /> } /> } /> } /> } /> } /> ); } // Alternative: Direct WebFRouterLink usage (similar to react_project example) export function AppDirectWebFRouterLink() { return (
); }