使用createBrowserHistory()重新加载不起作用。反应Js

时间:2018-12-10 12:46:53

标签: reactjs npm

使用createBrowserHistory({basename:'/ admin'})重新加载无效。反应Js。我使用npm run start来运行应用程序。我的配置是:

    output: {
    path: path.resolve('dist'),
    publicPath: '/admin',
    filename: 'app-[hash].js'
},
    devServer: {
    contentBase: './',
    historyApiFallback: true,
    host: 'localhost',
    port: 8081
},

这也是我的页面,只有重新加载才能使用斜线

 <Router path='/admin' history={history} >
            <div>
                <Switch>
                    <PrivateRoute exact path="/" component={MainIndexPage} refresh={false} />
                    <PrivateRoute exact path="/staff" component={StaffPage}  refresh={false}  />
                </Switch>
            </div>
        </Router>

0 个答案:

没有答案
相关问题