Search⌘ K
AI Features

Getting back to the Refactoring Process

Explore the process of refactoring a React Hello World app into Redux by writing your first reducer. Understand how reducers return a new state and why the reducer always outputs the updated application state, preparing you to manage the store effectively.

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.

Javascript (babel-node)
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 ...