SolidJSS
SolidJSโ€ข9mo agoโ€ข
6 replies
hyperknot

How to do partial reconcile?

I'd like to use reconcile on a partial / subset of my data.

How do you do this?

My best idea so far is to write this for loop:

for (const key of Object.keys(data)) {
  this.setState(key as any, reconcile(data[key as keyof typeof data]))
}


However this triggers a setState for each key, which isn't that good from a performance point of view, I guess.

reconcile seems to require the full state object to be present.

Has anyone written a reconcile which can take partial state as input?

Should I use batch()?

Or a simple reconcile with {...this.state, ...data}?
Was this page helpful?