Trying to use DataProvider and Dynamic Values with a child Text component. I get the message “No dynamic data available.”
Component code
import { DataProvider } from "@plasmicapp/loader-nextjs";
export function DataProviderContainer({ children, test }) {
return (
<div>
<DataProvider
name={"dataProviderContainer"}
data={`hello world ${test}`}>
{children}
</DataProvider>
</div>
);
}
Hey @injured_landfowl! Did you add providesData: true
to your component registration?
PLASMIC.registerComponent(DataProviderContainer, {
...,
providesData: true,
});
Hi @tiago thank you for the response. That worked!
I was following the documentation on: https://docs.plasmic.app/learn/data-code-components
It does not mention needing that prop in the component registration. Instead it makes it seem like just having the DataProvider component is all you need. See section: “Using fetched data in dynamic value expressions”
Just wondering did I miss the providesData prop in another area of the documentation? Thanks again!
Oh, indeed that documentation page is misleading right now! Thank you for pointing that. We will improve it to add that information. The data context will not work unless providesData
is specified in component registration.
oh cool. Thanks!