Skip to main content

Function: render()

render(element, appId, flags?): void

Defined in: render.tsx:107

Renders a React element tree into a GTK4 application window.

This is the main entry point for GTKX applications. It initializes the GTK4 runtime, creates an application container, and begins the React reconciliation process.

Parameters

ParameterTypeDescription
elementReactNodeThe root React element to render
appIdstringApplication ID in reverse domain notation (e.g., "com.example.myapp")
flags?ApplicationFlagsOptional GIO application flags for customizing behavior

Returns

void

Example

import { render, quit } from "@gtkx/react";

const App = () => (
<GtkApplicationWindow title="My App" onClose={quit}>
<GtkLabel label="Hello, GTKX!" />
</GtkApplicationWindow>
);

render(<App />, "com.example.myapp");

See

  • quit for shutting down the application
  • update for hot-reloading the rendered tree