Restructuring State

In this video we will restructure our state to concentrate our state in a single location. We will rebuild one of our stateful components into a simple functional component and concentrate our state in a single location

The code in our application at the end of this video is missing some core functionality. We have moved our score state into the application state in the Application component. We have not yet reproduced the ability to modify it.

0:00

Our application currently has one
stateful component, our counter.

0:04

This is actually not a great structure for
our application as a whole.

0:07

It was good for educational purposes to
demonstrate a simple stateful component.

0:11

However, the state of our counter
is really our player's score.

0:15

By keeping it stuck in the counter,
it makes it difficult to read and

0:19

use our player scores from
other part of the application.

0:22

So now we're actually going to revert our
counter back into a functional component

0:25

and relocate its state
up into the application.

0:30

So the first thing we'll do is pretty much
the opposite of what we did earlier on.