3 ms·
The entire view shouldn’t be redrawn but certain views only (not the entire tree) maybe look into prevent entire view from being redrawn itself (React does this
by pixel_tracing 4y ago
The entire view shouldn’t be redrawn but certain views only (not the entire tree) maybe look into prevent entire view from being redrawn itself (React does this too and you can prevent redraw without utilizing useMemo by understanding it’s internals)
- tadfisher 4y agoCompose bakes this into the framework at the function level. By default, if the function parameters are immutable and the function doesn't return a value (basically emits compositions by calling other Composable functions) the entire composition is memoized and the function can be skipped. The tricky part is knowing what is immutable, because standard JVM collections are not.
- saagarjha 4y agoSwiftUI has this too. It's not particularly discoverable but if you do it correctly you can avoid these kind of issues. The problem is that SwiftUI doesn't really make it particularly obvious when and how you might want to use this, which leads to issues like these.