...

/

Getting back to the Refactoring Process

Getting back to the Refactoring Process

In order to refactor our React app, we will first create the reducer directory along with our first primitive reducer function. We must remember that the reducer always returns a new state of the app.

We'll cover the following...

Let’s get back to refactoring the Hello World React application to use Redux.

If I lost you at any point in the previous section, please read the section just one more time and I’m sure it’ll sink. Better still, you can ask me a question.

Okay so here’s all the code we have at this point.

Press + to interact
import React, { Component } from "react";
import HelloWorld from "./HelloWorld";
import { createStore } from "redux";
const store = createStore(reducer);
class App extends Component {
render() {
return
}
}
export default App;

Makes sense?

You may have noticed a problem with this code. See Line 4.

The reducer function passed into createStore doesn’t exist yet.

Now we need to write one. The reducer is just a ...