Search⌘ K

Logging the State Object

Explore how to log the Redux state object each time the store updates within a Skypey app. Understand how to use a custom function to display the current state with styled console output. This lesson helps you track state changes effectively as you design and manage your app's data structure.

We'll cover the following...

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

Here’s how:

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

Javascript (babel-node)
function fancyLog() {
console.log("%c Rendered with 👉 👉 👇", "background: purple; color: #FFF");
console.log(store.getState());
}

Hmmm. What have I ...