I was digging into some of the code for React hooks the other day, right after reading Ali's great post on linked lists:
...
For further actions, you may consider blocking this person and/or reporting abuse
Seeing (what I thought only academic in nature) Linked List, used in React sounds great. It definitely helps on understanding "how" the fiber was implemented (as you also mentioned "why" in the Fiber documentation link).
I've also run into another place in React source, where they heavily utilizes Linked List.
React-cache is a reference implementation of upcoming data fetch feature.
The underlying implementation uses LRU (Least Recently Used) cache, which uses linked list to track cached resources.
Ooh! That one is a circular doubly-linked list, which is really cool!
I honestly still haven't been able to figure the whole code out yet 😅
Maybe I can do another one of these! I haven't read it yet though! Looks complicated!
Looking forward to your next post 🙂. Thank you :p
Thanks for this post, Conlin. I've a question, maybe a naive one. Am trying to reason about why Hooks need a Linked list implementation. One usecase (useCase? ;)) it definitely seems to facilitate is, share state of one Hook to another. Curious to hear your thought process on this.
Maybe also to run all the effects one after another.
Ignore this naive question. I think, I figured out. Linked List allows React to rely on the order of Hooks calls which means, it could preserve state between re-renders.
I think this attribute can be tried to be learnt as first learner of programming. However, what should I do to start it ? Should I follow and try to understand the code or what ?
Definitely check out Ali's post on Linked Lists: dev.to/aspittel/thank-u-next-an-in...
Hopefully this article isn't too difficult if you have some understanding of Javascript. I'd be happy to explain anything you find confusing!
Woah, this is so cool!
Great breakdown, Conlin!
Thanks Dan :D
What language is that? Doesn't it have a list type with append, delete, and insert methodss
You don't wwant to have to mess with null pointers and memory allocation, unless you really need to.