| 1 | "use client"; |
| 2 | |
| 3 | import { useState } from "react"; |
| 4 | |
| 5 | /** |
| 6 | * Lives in the (static) layout: client-side state here must survive waku's |
| 7 | * client navigation, because the router keeps the layout mounted while |
| 8 | * swapping page content. |
| 9 | */ |
| 10 | export function NavCounter() { |
| 11 | const [count, setCount] = useState(0); |
| 12 | return ( |
| 13 | <button |
| 14 | data-testid="nav-counter" |
| 15 | onClick={() => setCount((value) => value + 1)} |
| 16 | > |
| 17 | nav-count: {count} |
| 18 | </button> |
| 19 | ); |
| 20 | } |