Skip to content

Conditional re-rendering for Component embedded in Views #388

Answered by JaggerJo
KaiwenLiu1227 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @KaiwenLiu1227

Nice to see that the https://github.com/tomcl/issie project is considering Avalonia!

1 Component with key Identity

This method fits well with my demand. However it can't watch the change of all state, but only one string value as the key. I did have a kind of solution that combine all state of this component into a str as key which force the component re-render when any of attribute of state change, and it doesn't look like a right and efficient solution.

let renderSymbol props dispatch :IView=
    Component.create($"comp-{props.Id}-{props.x}-{props.y}-{...}", fun ctx ->
        polygon.create[...

Yes, currently view/component keys have to be strings - but there is…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@KaiwenLiu1227
Comment options

@JaggerJo
Comment options

Answer selected by KaiwenLiu1227
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