Logging the State Object

Now we'll write a function which logs all our store updates. This will be helpful in understanding if our contacts component is working properly.

We'll cover the following...

Each time the store updates and invokes render, let’s log the state from the store.

Here’s how:

Press + to interact
const render = () => {
fancyLog();
return ReactDOM.render(<App />, document.getElementById("root"));
};

Just call a new function, fancyLog() you’ll soon write. Here’s the fancyLog function:

Press + to interact
function fancyLog() {
console.log("%c Rendered with 👉 👉 👇", "background: purple; color: #FFF");
console.log(store.getState());
}

Hmmm. What have I ...