Frontend
use-view
@stone-js/use-react is not the view dimension itself; it is React's incarnation of it. Underneath sits @stone-js/use-view, a view engine that is agnostic of any particular UI library. Knowing it is there explains why the frontend feels like the rest of the framework.
#The view as a contract
The principle
A view layer bolted to one UI library ties the framework's fate to that library. Define the view dimension as a contract, pages, layouts, head, rendering, and any library can incarnate it, the same way any platform can be an adapter.
In Stone.js
use-view owns the runtime-agnostic pieces: the HeadContext, the view-provider concept, the render and prerender contracts. use-react plugs React into that contract. The seam is deliberate and open.
use-react is to use-view what a platform adapter is to the kernel: one incarnation of an open contract.
#What lives where
- use-view: the
HeadContext, view providers, the render / prerender / server-loader contracts, the SSG target. - use-react:
@Page,@PageLayout,@ErrorPage,StoneLink/StoneOutlet, the hooks, React rendering and hydration.
#Why it matters to you
In day-to-day work you use use-react and rarely touch use-viewdirectly. But the split is the reason the frontend is a first-class context rather than an add-on, and the reason a future view library could join without disturbing the kernel or your domain.