Invariant Violation: Could not find “store” in either the context or props of “Connect(SportsDatabase)”

后端 未结 9 1740
别那么骄傲
别那么骄傲 2020-12-12 10:36

Full code here: https://gist.github.com/js08/0ec3d70dfda76d7e9fb4

Hi,

  • I have an application where it shows different templates for desktop and mobile
9条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 11:11

    in the end of your Index.js need to add this Code:

    import React from 'react';
    import ReactDOM from 'react-dom';
    import { BrowserRouter  } from 'react-router-dom';
    
    import './index.css';
    import App from './App';
    
    import { Provider } from 'react-redux';
    import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
    import thunk from 'redux-thunk';
    
    ///its your redux ex
    import productReducer from './redux/reducer/admin/product/produt.reducer.js'
    
    const rootReducer = combineReducers({
        adminProduct: productReducer
       
    })
    const composeEnhancers = window._REDUX_DEVTOOLS_EXTENSION_COMPOSE_ || compose;
    const store = createStore(rootReducer, composeEnhancers(applyMiddleware(thunk)));
    
    
    const app = (
        
            
                
            
        
    );
    ReactDOM.render(app, document.getElementById('root'));

提交回复
热议问题