Skip to content

Overview

This section is the detailed reference for ReactPy. For an introduction, start with the Learn section.

The reference is split into functional subsections:

Hooks

Call these at the top level of a component. ReactPy provides twelve:

There is no use_id, use_transition, use_deferred_value, use_layout_effect, use_insertion_effect, use_imperative_handle, or use_sync_external_store. Texts ported from React that rely on them have no ReactPy equivalent.

HTML

How to describe markup. ReactPy has no JSX; you call functions.

  • Common Props — attributes shared by every tag.
  • Usage — the html.* functions and the shape of a VDOM dictionary.

Executors

The ASGI applications that serve your components:

  • ReactPy — standalone single-page app; components render on the server.
  • ReactPyMiddleware — add ReactPy routes to an ASGI app you already have.
  • ReactPyCsr — run component code in the browser via PyScript.

Template integration

  • Jinja — render components from Jinja templates.

Rules of React

Idioms for expressing React patterns so they stay understandable and correct:

Internals

Where React differs

ReactPy models React's function-component API, but it is not React. Effects infer their dependencies instead of requiring an array, state updates are replaced rather than merged, an update that mutates in place is dropped without any error, and several React hooks do not exist at all. Each page calls out the differences that matter to it, so when porting code or prose from a React tutorial, read the ReactPy page rather than assume parity.

Authors: Archmonger