builder icon indicating copy to clipboard operation
builder copied to clipboard

Error in <Content> component when integrating with Qwik

Open abouzoubaa opened this issue 2 years ago • 1 comments

Has anyone got this error : cannot find react in the line where there is :<Content in the following code: import { component$ } from "@builder.io/qwik"; import { routeLoader$ } from "@builder.io/qwik-city"; import { fetchOneEntry, Content } from "@builder.io/sdk-qwik";

// Define Builder's public API key and content model. // TO DO: Replace with your Public API Key export const BUILDER_PUBLIC_API_KEY = YOUR_PUBLIC_API_KEY; export const BUILDER_MODEL = "page";

// Define a route loader function that loads // content from Builder based on the URL. export const useBuilderContent = routeLoader$(async ({ url, error }) => { // Fetch content for the specified model using the API key. const builderContent = await fetchOneEntry({ model: BUILDER_MODEL, apiKey: BUILDER_PUBLIC_API_KEY, });

// Return the fetched content. return builderContent; });

// Define a component that renders Builder content // using Qwik's Content component. export default component$(() => { // Call the useBuilderContent function to get the content. const content = useBuilderContent(); // Specify the content model, pass the fetched content, // and provide the Public API Key return ( <Content model={BUILDER_MODEL}
content={content.value} apiKey={BUILDER_PUBLIC_API_KEY} /> ); });

abouzoubaa avatar Dec 19 '23 19:12 abouzoubaa

Could you format your issue better and add some more info? It's hard to understand as is.

samijaber avatar Jan 02 '24 15:01 samijaber

Closing this due to inactivity. Feel free to create a new issue with proper reproduction and context.

samijaber avatar Apr 09 '24 15:04 samijaber