서동휘
How do I use Solid.js with clear data model <-> UI primitive distinction?
Suppose I have a ES6
Map
object like following:
Then using Solid.JS, I want to create an user interface to modify this object.
But the problem with this is that editing a single file causes the re-render of the entire App.
The solution I have found is using ReactiveMap
(https://www.npmjs.com/package/@solid-primitives/map), which is a reactive variant of ES6 Map
. It works fine.
However I feel like I am altering the data model only because of the choice of UI library. I will be passing files
object to other functions which are irrelevant to Solid.JS, and they have to know what ReactiveMap
is. Seems like a sign of bad abstraction.
What would be a nicer way to handle this without losing fine-grained reactivity? Thank you 🙂5 replies