Mosh React Tutorial (part 7)

Updating Phase

Whenever new props is drilled down, our component updates and we look at the props and state.

In our case, say our Counter is at 4. Once we update it to 5, the state changes and triggers a render.

The render passes the updated 5 down to the prop. Hence our prevProps.counter.value will be 4, and our this.props.counter.value will b e 5. This signifies that our component did update and there is a change condition.

Unmounting Phase

When we delete, the state literally removes that Counter (object) in the array in the App class.

Thus, the change to the state makes App Render. Which then makes NavBar render. Which then makes Counters render.

As each Counter gets rendered, out of the Counters will Unmount because its id-ed object in the array has been removed.

Timers, listeners, all should be cleaned up in Unmount.