How to populate a state when is a data type?

I have a page state called “temp_product” and its type is “Product” (NOT a list).

Type “Product” has these fields:

  • name (text)
  • value (number)

I have an input box collecting a text and I would like to put this text into the “name” field of the state “temp_product”. How should be done?

@gianluca2

Consider handling a custom state called “temp_name” of type text instead.

Thanks for your reply. The question I posted is a simplification of the problem. Indeed, I need to add a thing that is referring to a data type, in which data are collected from some input boxes…

So … you have to find it from the info coming from the input boxes?

yes, exactly