yew icon indicating copy to clipboard operation
yew copied to clipboard

Implementing change for children

Open krampenschiesser opened this issue 6 years ago • 1 comments

Question

I am implementing a button of a third party JS framework (onsen). Anyway a button always receives children in the form of icons or its text. Now when I try to implement fn change(&mut self, props: Self::Properties) -> ShouldRender { my problem is how can I check that the children didn't change? I could render and then compare the HTML but that's excessive. Is there any easier way (eg id'ing the children)?

krampenschiesser avatar Jan 31 '20 12:01 krampenschiesser

Can't think of a better option than comparing the virtual nodes that Yew manages. It will be performant because this diff is what Yew is already doing on each render anyways.

jstarry avatar Feb 02 '20 14:02 jstarry