reactolith hydrates it into React
components.
To hide the unhydrated tree until React mounts, give your root
element the class hidden (and define
.hidden { display: none } in your CSS). After the first
React commit, reactolith removes that class to reveal the app:
This is configurable via AppOptions:
Custom appProvider implementations should call
app.notifyHydrated() from a useEffect so
the hidden class is removed and app.onHydrated(...)
listeners fire.
When navigating, reactolith fetches the
next HTML page and applies only the
differences using React's reconciler. Component state —
toggles, inputs, focus — is preserved.
Only the <h1> text and the pressed
prop are updated — everything else remains untouched.
The Router only intercepts clicks on actual <a>
elements with an href attribute. A custom component
like <ui-button> is not an anchor, so passing
href to it does nothing unless the component itself
renders an <a>. There are three ways to make
something clickable navigate:
Use a real anchor. The simplest option — wrap your component, or have your component wrap a child, with <a>:
Style the anchor to remove its default underline if needed. Semantically this is the correct shape: a link styled like a button.
Render-as-child (asChild) pattern. Many React component libraries built on Radix / Base UI (shadcn/ui being the common example) expose an asChild prop that swaps the rendered element for its child while keeping the styles and behavior. That gives you a single element that is the anchor:
Whether this works depends on the component library, not on reactolith. Reactolith only cares that there's eventually an <a href> in the DOM — the Router picks it up either way.
Programmatic navigation. When there's no link to click — e.g. after some local logic completes — reach into the Router from a hook:
Form submits go through the Router automatically — you only need router.visit() for navigation that isn't tied to a click on a link or a form submit.
Same-origin anchors are intercepted; external links, hash links,
target="_blank", rel="external", and
download attributes all opt out of SPA navigation and
let the browser handle them normally.