node.js - react應(yīng)用加了react-redux后webpack打包后頁(yè)面顯示空白,也沒(méi)有報(bào)錯(cuò)
問(wèn)題描述
開(kāi)發(fā)環(huán)境用webpack-dev-server運(yùn)行是可以的,生產(chǎn)模式下打包后把文件放到tomcat下打開(kāi)首頁(yè)就是空白頁(yè)了,而且沒(méi)有報(bào)錯(cuò)
下面是我app.js里的代碼,如果去掉Provider,直接引入組件是可以顯示的,加上react-redux后頁(yè)面就是空白了,請(qǐng)各位幫我看看問(wèn)題
/* --- 引入切換動(dòng)畫(huà)插件 ---*/const App = ({ children, location }) => ( <p className=’routerBox’><QueueAnim> {React.cloneElement(children, {key: location.pathname})}</QueueAnim> </p>)/* --- 注冊(cè)store ---*/const store = createStore(reducer);/* --- 路由 ---*/const renders = () => { render(<Provider store={store}> <Router history={browserHistory}><Route path =’/’ component={App}> <IndexRoute component={Signin}/> <Route path=’signin’ component={Signin}/> <Route path=’index’ component={Index}/> <Route path=’modifypwd’ component={Modifypwd}/> <Route path=’userdetail’ component={Userdetail}/> <Route path=’useredit’ component={Useredit}/> <Route path=’customerItem’ component={CustomerItem}/> <Route path=’customerAdd’ component={CustomerAdd}/> <Route path=’customerDetail/:id’ component={CustomerDetail}/> <Route path=’customerWriteinto’ component={CustomerWriteinto}/> <Route path=’customerWriteintoEdit’ component={CustomerWriteintoEdit}/> <Route path=’customerTran’ component={CustomerTran}/> <Route path=’customerInto’ component={CustomerInto}/> <Route path=’customerList’ component={CustomerList}/> <Route path=’customerEdit’ component={CustomerEdit}/></Route> </Router></Provider>,document.getElementById(’appLogin’) );}renders();/* --- 監(jiān)聽(tīng)當(dāng)前狀態(tài),判斷是否重新渲染 ---*/store.subscribe(renders);
問(wèn)題解答
回答1:已經(jīng)解決了,是路由history的問(wèn)題
回答2:謝謝樓主,也幫我解決了問(wèn)題。
相關(guān)文章:
