SolidJSS
SolidJSโ€ข3y agoโ€ข
15 replies
Rafael Hengles

how to avoid child component re-creation with For

I have a store that is a list of tuples: each tuple is like ["type as string", { item, props }].

One of these items contains a value that I want to change like a controlled input, with a 'value' and a 'setValue' prop.

The problem is that when I call "setStore" to update the item value, the entire tuple is a new tuple with the changed value, it's not the same old tuple with the value mutated in place.

I use the <For> component to render this store list. AFAIU, when the For sees a new tuple, it removes the old <div> created by my component and recreates it all over again.

How can I have a store that is a list of tuples and change one value in this tuple without Solid re-creating my child components all the time ?
Was this page helpful?