Open fi3ework opened 5 years ago
@AjaxSolutions Thanks for replying. I checked Dan's three suggestions provided. I guess the
Option 1 (Preferred): Split contexts that don't change together
is corresponding to the method I mentioned? So the key point is to separating the context to avoid re-render triggered by unrelated context value?
But the README in unstated-next, it seems like telling us separate the component which will be render but not the composite context.
I'm working on a solution for splitting the hook into multiple contexts here: https://github.com/diegohaz/constate/issues/93#issuecomment-540905737
Leaving it here because it may serve as a reference for a future work on unstated-next, but I'd love a feedback on that API too! :)
cc @jamiebuilds
In README there's a performance optimization method
I don't quite understand how it optimize performance. IMO, the separated component render as much times as before separating and I made a small demo: https://codesandbox.io/s/dark-http-selxh. The ExpensiveComponent will console as long as parent component's useContainer value changed.
Could anybody tell me about the correct understanding of it? 🤔