Recently tried adding redux to one of the apps. One of the solutions is to have root component wrapped within Provider. Did this, but still seeing below issue (in the browser). [Pasted only potentially relevant code from files].
Uncaught Error: Could not find "store" in either the context or props of "Connect(Gallery)". Either wrap the root component in a , or explicitly pass "store" as a prop to "Connect(Gallery)".
client/main.js
document.addEventListener('DOMContentLoaded', function() {
ReactDOM.render(
<Provider store={store}>
<App/>
</Provider>,
document.getElementById('mount')
);
});
shared/App./js
class App extends React.Component {
render() {
return (
<BrowserRouter history={ browserHistory }>
<div>
<Route exact path="/" component={Gallery} />
<Route path="/viewitem/:id" component={ViewItem} />
</div>
</BrowserRouter>
);
}
}
shared/redux/index.js
export const reducers = combineReducers({
images: imageReducer,
});
export function configureStore(initialState = {}) {
const store = createStore(
reducers,
initialState,
applyMiddleware(...middleWare)
)
return store;
};
export const store = configureStore();
Could it be that BrowserRouter might not work with redux?