why is the redux store state shown false within render even though the default state is true?

I’ve created a Codesandbox demonstrating the order of procedure and the current redux state.

As you can see, the Redux state is actually up-to-date with the state you’d expect. However, the component state is never being set initially. This is because the callback you are passing to the subscribe function is never called on mount.

You can solve this problem by setting the initial state to the redux state in the constructor:

class App extends React.Component {

  constructor() {
    super();
    this.state = store.getState();
  }

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top