Frontend
Frontend
The frontend is another context, not another framework. The same kernel, routing and dependency injection you use on the server now produce views. @stone-js/use-reactis the React incarnation of the view dimension, and this documentation site is built with it.
#Enable React
Add the React view engine and a browser adapter to the manifest. Everything in this section assumes these are in place; where you render (CSR, SSR, SSG) is a separate choice covered on the rendering page.
import { StoneApp } from '@stone-js/core'
import { Routing } from '@stone-js/router'
import { UseReact } from '@stone-js/use-react'
import { Browser } from '@stone-js/browser-adapter'
@Browser() // run in the browser
@UseReact() // render with React
@Routing()
@StoneApp({ name: 'tasks-ui' })
export class Application {}import { defineStoneApp } from '@stone-js/core'
import { routerBlueprint } from '@stone-js/router'
import { useReactBlueprint } from '@stone-js/use-react'
import { browserAdapterBlueprint } from '@stone-js/browser-adapter'
export const App = defineStoneApp(
{ name: 'tasks-ui' },
[routerBlueprint, useReactBlueprint, browserAdapterBlueprint]
)A page is a route that resolves into a view. Same kernel, same routing, a different kind of result.