Is there a drop in JS Array-compatible React/Vue-friendly linked-list library?

zspencer

Zee

Posted on January 21, 2019

Is there a drop in JS Array-compatible React/Vue-friendly linked-list library?

Hello friends!

I have the following collection:

messages = [{ ... }, { ... } ]

Which I sometimes map over, unshift, and push onto. It hit me... 2 months ago... that really it needs to be a linked list, and not an array; as sometimes I need to render different things depending on information in the next or previous message.

I've procrastinated swapping out the collection's underlying data structure because most of the bugs were not related to the array-ness of the messages collection.

However I'm finally butting up against some bugs (again) where swapping the array for a linked list seems like the most reasonable course of action.

Do any of you know about a drop-in JavaScript Array replacement that plays nicely with the reactive nature of Vue 2?

I've found that most drop-in replacements don't take into account that Vue requres you to use Vue.set when adding new properties to an Object; and most LinkedList implementations use an object as their underlying data structure.

Any help would be greatly appreciated!

Zee

💖 💪 🙅 🚩
zspencer
Zee

Posted on January 21, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related