-
-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keys implementation? #9
Comments
Hey, I haven't. Let me know if you find something or if you try to do it yourself, I'd like to add a link to it. |
I implemented this in fre. It has the same performance as react, but it's super simple. |
@yisar can you explain the general algorithm you use? I can’t seem to figure out from the code itself sorry :) |
@brainkim Well, I can explain it, it is similar to React. A B => B A
Generally speaking, it is actually the processing of insertpoint and reuse. In React, it distinguishes a variety of situations, and Fre super simplifies it. You can try to debug them by yourself! |
Hi @yisar Did you change the implementation of reconciliation in fre? I'm confused after reading the explanation and the code. Thanks |
@Combo819 In Fre2 version, I refactor the reconciliation algorithm. The new algorithm uses Collision pointer for preprocessing, which is better implemented and easier to understand. I can reinterpret the new algorithm implementation in Fre2: 1 2 3 4
1 3 2 4 We traverse from both ends to the middle, and find that 1 and 4 are exactly the same, then we skip them, and then it becomes: 2 3
3 2 The remaining nodes can be reused. We save their DOM references. Finally, we just need to change the position, that is, 3 is inserted in front of 2. Of course, if you are interested in the old algorithm, you can look up the code of fre1, but I think fre2 will be better. |
Hi. I’m wondering if you considered implementing the react key prop? Wondering what that looks like under the hood and haven’t found an approachable resource for it yet.
Thanks for the blog posts/implementation!
The text was updated successfully, but these errors were encountered: