Skip to content

Instantly share code, notes, and snippets.

View nathanbabcock's full-sized avatar
🛠️

Nathan Babcock nathanbabcock

🛠️
View GitHub Profile
/*
* BorrowMap: (possibly) zero-copy mutable data structure in a react context
* =========================================================================
*
* The idea behind this concept is that we can have a mutable container in a
* React-linked store but ONLY IF we never share a reference to the mutable
* container itself. All the reads must be contained inside selectors. As long
* as no one has a second reference to the mutable container, then we are sure
* that no one is able to read/write it without us knowing.
*