I'm new to React and I was wondering if there is there a better way of writing the following function while maintaining same functionality? Any help is much appreciated.

```
    let temp;
          temp= this.state.persons.map(person=> {
            if (person.id == this.person.id) {
              person.userInput= this.state.userInput;
              person.secondInput= this.state.secondInput;
              return person;
            } else {
              return person;
            }

```