Using plain old JavaScript objects to manage data gets old very quickly. It's error-prone, tricky to track changes efficiently, and easy to mista

TinyBase

submited by
Style Pass
2022-01-14 19:30:04

Using plain old JavaScript objects to manage data gets old very quickly. It's error-prone, tricky to track changes efficiently, and easy to mistakenly incur performance costs.

Tiny by name, tiny by nature, TinyBase only costs 2.6kB - 5.5kB when compressed, and has zero dependencies. And of course it's well tested, fully documented, and open source. Other FAQs?

Creating a Store requires just a simple call to the createStore function. Once you have one, you can easily set Table, Row, or Cell values by their Id. And of course you can easily get the values back out again.

The magic starts to happen when you register listeners on a Store, Table, Row, or Cell. They get called when any part of that object changes. You can also use wildcards - useful when you don't know the Id of the objects that might change.

More magic! The useCell hook in this example fetches the dog's color. But it also registers a listener on that cell that will fire and re-render the component whenever the value changes.

Leave a Comment
Related Posts