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 errors3 Replies
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:
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.Helpful Links:
Routes | Fresh docs
Dynamic routes | Fresh docs
Layouts | Fresh docs
Create a route | Fresh docs
Fresh 1.2 – welcoming a full-time maintainer, sharing state between islands, limited npm support, and more
Fresh 1.4 – Faster Page Loads, Layouts and More
Fresh 1.3 – Simplified Route Components and More
You Don't Need a Build Step
What kind of data?
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