Getting Started

Hello React

Render a component from a controller, with no socket

  • dead view
  • SSR

Key concepts

react/1 works in any Phoenix template, not only inside a LiveView. This page has no socket: the component is server-rendered on the first request and hydrated in the browser, and there is no websocket behind it.

Simple.jsx
import React from "react";

export function Simple() {
  return <div>Hello world!</div>;
}

How it works

The component is rendered by a plain function component from a controller action. Use this when you want React for its own sake — a widget, a chart, a third-party library — without any server-driven state.