To fetch or load references or Symbols, you must use enrich
in your calls to fetch multiple entries from Builder.
Pass in the options
object with enrich: true
when using getAll()
in a Gen 1 SDK and fetchEntries()
in a Gen 2 SDK. This provides a consistent experience between the Visual Editor and the live site.
Tip: Builder enriches by default for Gen 1's builder.get()
and Gen 2's fetchOneEntry()
.
To fetch or load references or Symbols, be sure to manually pass in enrich: true
when using getAll()
.
import { builder } from '@builder.io/react';
const pages = await builder.getAll('page', {
// to fetch references and Symbols
options: { enrich: true }
});
To fetch or load references or Symbols, be sure to manually pass in enrich: true
when using fetchEntries()
.
import { fetchEntries } from '@builder.io/sdk-react';
const pages = await fetchEntries({
model: 'page',
apiKey: 'YOUR_API_KEY',
// to fetch references and Symbols
options: { enrich: true }
});
For more detail on the Gen 2 (or Mitosis) SDKs, see the Builder GitHub repo.