Skip to content

Commit

Permalink
Grammar improvements to register-routes.md
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepiercy authored Jan 20, 2025
1 parent 2d54d58 commit 5bd4a31
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/registry/docs/how-to-guides/register-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ myst:
html_meta:
"description": "How to register new routes in @plone/registry"
"property=og:description": "How to register new routes in @plone/registry"
"property=og:title": "How to register new routes"
"property=og:title": "How to register new routes in @plone/registry"
"keywords": "Volto, Plone, frontend, React, configuration, routes, React Router"
---

# How to register new routes
# Register new routes

````{admonition} Warning! This feature is experimental and only applies to register routes for React Router 7 applications. Click to accept the risks and read details.
````{admonition} Warning! This feature is experimental and only applies to registering routes for React Router 7 applications. Click to accept the risks and read details.
:class: warning
The `config.registerRoute` method will add a new route to the configuration registry.
This route is intended to be loaded by the `@plone/react-router` helper and loaded in a React Router 7 app.
Under the hood, it saves the routes in the `config.routes` key in the configuration object.
You should provide one route at a time and should have this shape:
The `config.registerRoute` method adds a route to the configuration registry.
The `@plone/react-router` helper loads the route and configures it in a React Router 7 app.
It saves the routes in the `config.routes` key in the configuration object.
You should provide one route at a time in the following structure.
```ts
type ReactRouterRouteEntry = {
Expand All @@ -31,12 +31,12 @@ type ReactRouterRouteEntry = {
};
```
The `type`, `path` and `file` are mandatory.
The `type` key specify the route type to be created, more specifically, one of `route`, `index`, `layout` or `prefix`.
The `type`, `path`, and `file` are mandatory.
The `type` key specifies the route type to create, specifically one of `route`, `index`, `layout`, or `prefix`.
The type `route` can contain nested routes.
Check the official [React Router 7 documentation](https://reactrouter.com/start/framework/routing) for more information on how to define React Router 7 routes.
You register a route like this:
Register a route as shown in the following example.
```ts
config.registerRoute({
Expand All @@ -50,5 +50,5 @@ config.registerRoute({
});
```
It is required that you set the full module path name for the registered route component in order to make `@plone/registry` to it address correctly when it's going to be used.
You must set the module's full path name of the registered route component to make `@plone/registry` correctly address it.
````

0 comments on commit 5bd4a31

Please sign in to comment.