-
Notifications
You must be signed in to change notification settings - Fork 50.5k
Description
Hello. I want to ask a question about a way to avoid reconciliation process.
Today I can see the following process:
- Component wants to re-render.
- Component render method provides new virtual dom.
- Some react diff library tries to find some non-optimal way to morph old virtual dom into new one.
Please fix me if I am wrong, I am not familiar with react codebase.
I can see an information in docs:
you don’t have to worry about exactly what changes on every update
But your solution has complexity about O(n) or even worse, so user should care about what changes sometimes. When user knows what changed he will be able to provide O(log n) or even O(1) solution.
For example I am working with huge data list and I am receiving information from websocket about how to morph my list: append/prepend, remove, swap items, etc. I don't want to render huge component list and run reconciliation process for each mutation. I can tell virtual dom how to morph efficiently.
Is there a way for user to provide morph method? I can imagine some api like:
// render is not defined
morph(component) {
if (...) {
component.append(<Item />);
} else {
(<Item />).prependTo(component.find({ key: '5' }));
}
}
Do you have any plans to implement it? Thank you. Please feel free to ask any questions.
