Stone.jsDocs
Paradigm

Frontend

Components & links

Below pages and layouts, you write ordinary React components. The framework adds a few primitives for links and outlets, and a set of hooks so a component can reach the router, the container, config and the current data without prop drilling.

#Framework components

ComponentTypeDescription
<StoneLink to={} />linkClient-side navigation in SPA/SSR, a normal link where that is right.
<StoneOutlet>outletWhere a layout renders its page.
<StonePage />page mountMounts a resolved page (advanced; used internally and for custom shells).
app/pages/TaskRow.tsxtsx
import { StoneLink } from '@stone-js/use-react'

export function TaskRow ({ task }: { task: Task }) {
  return <StoneLink to={`/tasks/${task.id}`}>{task.title}</StoneLink>
}

#Hooks

Hooks are how a component reaches the application. They work the same on the server render and in the browser.

HookTypeDescription
useData<T>()() => TThe current page data (from the page handle).
useRoute()() => RouteThe active route: name, params, path.
useRouter()() => RouterThe router: generate URLs, navigate.
useHead(head)(head) => voidSet document head from within a component.
useConfig()() => ConfigThe read-only Blueprint config.
useService(alias)(alias) => TResolve a service from the container.
useContainer()() => ContainerThe container itself (advanced).
useEventEmitter()() => EmitterEmit and listen to domain events.
useEvent()() => IncomingEventThe current incoming event (the intention being rendered).
useRawEvent()() => rawThe platform’s raw cause (escape hatch; rarely needed).
useBlueprint()() => BlueprintThe frozen manifest, for advanced introspection.
useRuntime()() => RuntimeThe React runtime (SSR/CSR state).
useStone()() => contextThe full Stone context, when you need several of the above at once.
app/pages/TaskCount.tsxtsx
import { useData, useRouter } from '@stone-js/use-react'

export function TaskCount () {
  const tasks = useData<Task[]>() ?? []
  const router = useRouter()
  return <a href={router.generate({ name: 'tasks.list' })}>{tasks.length} tasks</a>
}

#Everything else is React

Beyond these, there is nothing special: your components are plain React, free to use hooks, context and libraries as usual. The framework primitives exist only where the app boundary needs to show through.


Stone.js

Your app exists in every runtime. Until you run it.

An open-source project by Stone Foundation
Created by Mr. Stone (Evens Pierre)