Skip to content

Document how the state of a Component can be managed#2556

Merged
hecrj merged 1 commit intoiced-rs:masterfrom
dtoniolo:docs
Sep 13, 2024
Merged

Document how the state of a Component can be managed#2556
hecrj merged 1 commit intoiced-rs:masterfrom
dtoniolo:docs

Conversation

@dtoniolo
Copy link
Contributor

Hi,
first of all thanks for your work on this amazing library: I've completed some toy projects with it and it was a pleasure to use.

While going through some of the examples I encountered a few challenges in understanding how Components work, particularly regarding:

  • How are the methods of a Component called? Is the invocation handled automatically by the runtime, or does this responsibility lie with the parent component?
  • Why is the state passed as an argument instead of being part of the Component?

After spending some more time experimenting and reasoning through these questions, I believe I've gained a better understanding. However, I realized that other newcomers might face similar difficulties, so I decided to add a couple of sections to the documentation of Component. I hope that these additions will help others grasp these concepts more quickly.

My contribution is based on my current understanding, so I'm completely open to feedback. If there are any inaccuracies or areas where improvements can be made, I'm more than willing to make the necessary revisions.

Lastly, if you think that expanding the documentation on this topic more would be valuable, I'd be happy to put together a pull request to add a dedicated page to the official book that explains how components work and how to use them effectively.

@airstrike
Copy link
Contributor

FYI Component has been deprecated: 9426418

@hecrj hecrj added this to the 0.13 milestone Sep 13, 2024
@hecrj hecrj changed the title Improves the Documentation of Component Document how the state of a Component can be managed Sep 13, 2024
@hecrj hecrj added improvement An internal improvement documentation labels Sep 13, 2024
Copy link
Member

@hecrj hecrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I removed the lifetime section since it was not really accurate. It's unclear what you meant by "parent component"; there is no such thing.

@hecrj hecrj enabled auto-merge September 13, 2024 20:43
@hecrj hecrj merged commit e0da42e into iced-rs:master Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation improvement An internal improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments