Easy link holding of child component
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start with the html! component creation syntax described here and read the discussion in issue #1255, including the ComponentLink and NodeRef alternatives. Define the supported reference-passing behavior and verify that a parent can use it to send messages to its child component without relying on runtime NodeRef checks.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
Suppose I have components A and B, where A is composed of B. Now A wants to send some messages to B. This would be easy, if A has a direct reference to B's link.
Describe the solution you'd like
It would be useful, if we can pass a reference during creation of the component using html!, e.g.
html! {
<ChildComponent link_ref=self.my_child />
}
Where self.my_child would be of an appropriate type, probably something like Option<ComponentLink<ChildComponent>>.
It was also considered to use ref directly for this, s.t. the link can be taken from the NodeRef directly. Whilst probably being quite intuitive (I actually search for the proposed functionality at first in in that struct), I think it would require runtime checks if the NodeRef actually points to a component or not. This might lead to less idiomatic code.
Describe alternatives you've considered
See below for discussion. There is also a workaround.
Additional context
See #1255 for initial discussion.
- Dominant language
- Rust
- Stars
- 32.8k
- Forks
- 1.5k
- Avg merge
- 5h 34m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from yewstack/yew
-
documentation
Difficulty 3/5 1-2 days Newbie friendliness 70/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
documentation
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
bevyengine/bevy#25861 ·
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
enhancement remote
Difficulty 2/5 1-3 hours Newbie friendliness 68/100