Skip to content

Components

reactpy_router.route(path, element, *routes)

Create a route with the given path, element, and child routes.

Parameters:

Name Type Description Default
path str

The path for the route.

required
element Any | None

The element to render for this route. Can be None.

required
routes Route

Additional child routes.

()

Returns:

Type Description
Route

The created route object.

Create a link with the given attributes and children.

Parameters:

Name Type Description Default
attributes dict[str, Any]

A dictionary of attributes for the link.

required
*children Any

Child elements to be included within the link.

()

Returns:

Type Description
Component

A link component with the specified attributes and children.

reactpy_router.navigate(to, replace=False, key=None)

Navigate to a specified URL.

This function changes the browser's current URL when it is rendered.

Parameters:

Name Type Description Default
to str

The target URL to navigate to.

required
replace bool

If True, the current history entry will be replaced with the new URL. Defaults to False.

False

Returns:

Type Description
Component

The component responsible for navigation.


Last update: October 17, 2024
Authors: Mark Bakhit