Skip to main content

Fetching from bricks with RSC

Since v4.2, it is possible to directly fetch external data from a brick, without having to create the getExternalData on a pageType.
This works for both bricks in server components projects using the react-bricks/rsc library and bricks using the standard react-bricks/frontend library.

In a brick, we can just add to the schema a getExternalData function, which should be an async function, returning a promise that resolves to an object. This object will be merged to the component's props.

See the new External Content documentation.