I have the following in App.js. For debugging purposes, I can console.log
the current state with store.getState()
.
const App = () => {
const store = createStore(reducers);
console.log(store.getState());
return (
<Provider store={store}>
<Router />
</Provider>
);
};
export default App;
Now how can I console.log store.getState()
from containers within this app.
Update: Following the 'connect' suggestion in the comments, this is a bottom part of the code in a container:
export default connect(mapStateToProps, {
Decrease,
Increase,
selectNumber
})(TableGenerator);
Where would I add the getState()
?
connect
helper from 'react-redux', have you tried it?debugger
at any point in your code would do the trick.