Skip to main content

Hi all

I have written LWC that adds a new row whenever I click on the plus button but the newly added row inherits the value from the previous row. I want to set the values for the newly created rows as optional. Can anyone please help me here?

 

New Row inherits the value of previous row

 

#LWC Component  #LWC Development  #LWC

3 answers
  1. Aug 12, 2025, 4:07 PM

    Hii,

    If you want to ensure that newly added rows do not inherit values from the previous row, you should make sure that the data structure you use to hold the rows is initialized with completely new values each time(ideally blank here).

    You can use row add approach something like this 

0/9000