Updating React Nested State Properties

Ankit Kumar Rajpoot
1 min readDec 11, 2019

--

Initial State

The initial state is nested, there is an address is another object which is inside of a state.

Initial state

setState

setState using spread operator at each level, like:

setState

We are using document.getElementById(“firstName”).value for fetch data from input field, we can also use event.target.name but it is too confusing.

Note:- For any query, you may comment in this section or message me on Facebook.

--

--

Ankit Kumar Rajpoot
Ankit Kumar Rajpoot

Written by Ankit Kumar Rajpoot

I’m a MERN Developer. ( Redux | AWS | Python ) I enjoy taking on new things, building skills, and sharing what I’ve learned.

No responses yet