Need help with embedded inputs

What are you trying to do?

I’m trying to update a JSON file through Input fields. Within the JSON file, there are 3 items and then each of those items have 2 items.

I created a component, so that the component can repeat based on the items from the JSON. Within that component there are two Text Inputs. I was able to get the first input to work, but I’m having a hard time getting the second input to map properly.

What have you tried so far?

Relevant links:

Specifically Medium2 is the closest that I’ve gotten

You are using currentItem and currentIndex for both sets of repeated items, which creates ambiguity. Instead, you should use different names for the inner repetition, such as innerCurrentItem and innerCurrentIndex, or select semantically relevant names.

Then, update the onChange event handler as follows:

innerCurrentItem.name = $state.newInput[currentIndex][innerCurrentIndex].value


This might be a good example to add to the documentation for repeated elements; I don’t think there is great documentation on how useful the Element Name or Index name are.

It might be the case that Plasmic Levels have the instructions; but once you are using Plasmic after a while, the Levels aren’t really something that are easily refered back to and as a user, its more likely to go to the Documentation; maybe if the Levels could also be embedded in the Documentaiton?

@sarah_ahmed as a bonus, can you show me how I would put a button to now persist the new values into the state variables? (I’m 99% sure I know how to do it, but I feel like I’m going to be referring back to this thread in the future)