Skip to content

Universal React integration for Stone.js, supports SSR, SPA, pages, layouts, head management, and snapshots. Build context-aware apps with full rendering control.

License

Notifications You must be signed in to change notification settings

stone-foundation/stone-js-use-react

Stone.js - Use React

npm npm npm Maintenance Build Status Publish Package to npmjs Quality Gate Status Coverage Security Policy CodeQL Dependabot Status Conventional Commits

React integration for Stone.js, universal rendering, SSR hydration, layouts, pages, snapshots, head management, and more.


Overview

@stone-js/use-react connects the Stone.js Continuum Architecture to the React ecosystem.

It provides:

  • Universal rendering for SSR and SPA
  • Powerful Page and Layout components with optional decorators
  • A smart Snapshot system to sync server/client state seamlessly
  • Dynamic <StoneLink>, <StoneClient>, and <StoneServer> rendering
  • Integration hooks for popular tools and design systems

Use it to build fully reactive apps that run everywhere, Node.js, the browser, or serverless platforms, without giving up fine-grained control over context and rendering strategy.

Installation

npm install @stone-js/use-react

Important

This package is pure ESM. Make sure your package.json includes "type": "module" or configure your bundler accordingly.

Usage

This package is designed to be used inside a Stone.js app and integrates deeply with its lifecycle, adapter system, and blueprint configuration.

You can define Pages and Layouts:

import { Page } from '@stone-js/use-react'

@Page('/about')
export class AboutPage {
  render() {
    return <div>About Stone.js</div>
  }
}

You can hydrate data with snapshots:

import { Stone } from '@stone-js/core'
import { Snapshot } from '@stone-js/use-react'

@Stone({ alias: 'userService' })
export class UserService {
  @Snapshot()
  showProfile() {
    return { name: 'John Doe' }
  }
}

You can render elements conditionally:

<StoneClient>Visible on client</StoneClient>
<StoneServer>Visible on server</StoneServer>

And much more.

Learn More

This package is part of the Stone.js ecosystem, a modern JavaScript framework built around the Continuum Architecture.

Explore the full documentation: https://stonejs.dev

API documentation

Contributing

See Contributing Guide

About

Universal React integration for Stone.js, supports SSR, SPA, pages, layouts, head management, and snapshots. Build context-aware apps with full rendering control.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors 2

  •  
  •