Skip to content

Components encapsulating state/view/update? #53

Answered by ivanceras
yatesco asked this question in Q&A
Discussion options

You must be logged in to vote

You can do it however you want. You can split it or not just like how you decide to write your functions. The function view is needed to be implemented in the your component as it needs to implement the Component trait. The other view_<specific> functions which are parts of the main view function will need to be implemented in your bare component that is not part of the impl Component for <your_component>.

The minimal and other simple examples demonstrate the use of only one view while other examples such as the todo and window-tab-rows demonstrate the use of view function being split into view of other details/fields contained in the component struct.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yatesco
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