nandi
nandi7mo ago

Passing props to component from layout

I'm trying to pass some client side data from layout to route component, how do I pass this in? I tried props on <Component> but that was giving me errors
3 Replies
Deno AI Helper
Deno AI Helper7mo ago
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the context of your message, it seems like you might be working with a Deno-related web framework or library that uses the concept of layouts and components, such as Fresh or Aleph.js. If you're trying to pass props from a layout to a route component, the exact syntax and method can vary depending on the framework you're using. In general, frameworks that follow React-like patterns would allow you to pass props to components by specifying them as attributes on the component tag. For example, in a React-like syntax, you might do something like this:
<Component someProp={someValue} />
<Component someProp={someValue} />
However, since you mentioned that using props on <Component> gave you errors, there might be a syntax issue or the framework you're using might have a different way of handling props. Please note that this advice is not based on the Deno documentation, and I would recommend double-checking the accuracy of this advice with the specific documentation or community resources for the framework or library you are using. If you're using a Deno web framework like Fresh or Aleph.js, make sure to consult their respective documentation or seek help from their communities for the correct way to pass props from layouts to components.
MaDsEn
MaDsEn7mo ago
What kind of data?
nandi
nandiOP7mo ago
a Signal type in this case btw, I figured out how to do it without passing to layout component props, still kinda curious if it's possible though

Did you find this page helpful?