Skip to content

Correct way to pass data from block to magewire component underneath #36

Answered by Kizbo
Kizbo asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thanks for the quick reply.
I agree with you that magewire component should be the one providing data - but how can i pass this data in this scenario?:
I have some kind of a tree structure, that is rendering child blocks dynamically based on number of items inside that tree:

foreach ($item['items'] as $subItem)
                    echo $block->getLayout()
                        ->getBlock("categories.item")
                        ->setData("item", $subItem)
                        ->toHtml();

In this case, how can i pass "$subItem" to the magewire component inside this block?

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@wpoortman
Comment options

@Kizbo
Comment options

@Kizbo
Comment options

@wpoortman
Comment options

@Kizbo
Comment options

Answer selected by Kizbo
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
Converted from issue

This discussion was converted from issue #35 on May 24, 2022 06:55.