Reputation: 555
I am working on the basic project from the Redux Documenation page. I am unsure the best way to put a redux project on Stack Overflow, so I instead uploaded my current progress to my GitHub page: https://github.com/davidreke/reduxDocumentationProject
I finished the instructions on setting up my reducers/store/action creators/ etc and got to the section of this page (https://redux.js.org/basics/store) that says
Now that we have created a store, let’s verify our program works! Even without any UI, we can already test the update logic.
However, when I tried making a blank page, I don't see any the console.logs that I have coded into store.js in my app folder, and I am unable to console.log(store.getState()). When I open up the Redux dev tool, I also see in there that there is no state. What am I doing wrong that no state loads in my application?
Edit: I've also never asked a question about an application that involves reduce and/or so many files, so if there is a better way for me to present my question, please let me know!
Upvotes: 0
Views: 459
Reputation: 16152
You are not using the store. In your App.js
file import store and Provider then pass the store to the provider.
export store from store.js
export const store = createStore(todoApp)
// you can also add the store to the window object
// and use the console to play around with the data
//window.store = store
Then import store in your App.js
import React from 'react';
import './App.css';
import {
Provider
} from 'react-redux';
import { store } from './app/store';
function App() {
return (
<Provider store={store}>
<p>test</p>
</Provider>
);
}
export default App;
Upvotes: 1