Skip to main content

React DOM library

For websites and applications using React, the @tairu/react-dom package exposes a Tile component to load and render Tiles.

Installation

npm install @tairu/react-dom

Usage

The Tile component simply needs to be provided the Tile URL to load and render:

import { Tile } from '@tairu/react-dom'

function MyComponent() {
return <Tile url="http://localhost:3210" />
}

The Tile component exported from the main @tairu/react-dom module is a Client component, which means that it will load and render the Tile contents in the browser.

Server component

The Tile component can be used as a Server component when imported from the @tairu/react-dom/server module. Using this import, the Tile contents will be loaded and pre-rendered on the server (or during the build process for static websites), and interacions handlers will be added client-side.

A Suspense boundary need to be present in order to load the Tile as a server component, for example:

import { Tile } from '@tairu/react-dom/server'
import { Suspense } from 'react'

function MyComponent() {
return (
<Suspense>
<Tile url="http://localhost:3210" />
</Suspense>
)
}

Next.js support

The @tairu/next package provides a higher-level integration for Next.js based on the React DOM package.