Skip to content

Pass object to child component #6007

Answered by EisenbergEffect
sayers24 asked this question in Q&A
Discussion options

You must be logged in to vote

Great question. I think there are a variety of approaches you can take. I'll toss a few out here and then maybe we can work together to determine the best approach for your scenario.

Bindings

If both the parent component and the child component exist within a FAST templates, then you can actually use a binding to connect the two together. The approach would be to add a ref to the parent component and then a binding to that ref's property on the child component. Something like this:

const template = html`
  <parent-component ${ref('parentComponent')}>
    <child-component :inputProperty=${x => x.parentComponent.outputProperty}></child-component>
  </parent-component>
`;

Known Lookup

Anothe…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@sayers24
Comment options

Answer selected by sayers24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants