SolidJSS
SolidJSโ€ข2y agoโ€ข
9 replies
binajmen

How to set a new value in a store of `Record<string, __>`?

In the following example:
https://playground.solidjs.com/anonymous/07b233f7-59cb-4202-a3ca-595a497912f8

setValue("abc", 3) on a blank object will trigger an error:
Uncaught TypeError: Cannot read properties of undefined (reading 'output')

Probably because the internal of the Store's path syntax function is trying to access the data.

Am I suppose to use the Immer inspired produce to add a new element to an object, or is there a syntax I don't know to use directly the setter from the store without using produce?
Quickly discover what the solid compiler will generate from your JSX template
Was this page helpful?