2

我正在使用 React-Router 并且刚刚更新了我的路由以合并嵌套的 URL,它似乎破坏了 Webpack 的实时重新加载:

<Route path="/" component={App} ignoreScrollBehavior>

  <Route path="dashboard" component={Dashboard}>
    <Route path="greeting" component={Greeting}>
      <IndexRoute component={ButtonArray}/>
    </Route>
    <Route path="zest" component={Zest}>
      <IndexRoute component={ButtonArray}/>
    </Route>
    <Route path="blank" component={Blank}>
      <IndexRoute component={ButtonArray}/>
    </Route>
    <Route path="reports" component={Reports}/>
    <Route path="customer" component={Customer}/>
    <Route path="ads" component={Ads}/>
    <Route path="survey" component={Survey}/>
    <Route path="arrival" component={Arrival}/>
    <Route path="data_collection" component={DataCollection}/>
    <Route path="website" component={Website}/>
    <Route path="stores" component={Stores}/>
    <Route path="store_address" component={StoreAddress}/>
    <Route path="service_desks" component={ServiceDesks}/>
    <Route path="business_hours" component={BusinessHours}/>
    <Route path="customer_servants" component={CustomerServants}/>
  </Route>

</Route>

有没有人使用 webpack 热重载也看到这一点?现在,除非我在 localhost:8000/ 或 localhost:8080/dashboard,否则每当我保存更新时,实时重新加载都会中断,并会出现一个简单地指向 index.html 中的 app.js 的神秘(无用)错误

有没有比我上面展示的更好的方法来合并嵌套路由?

我需要一个基本 / 端点,我需要一个 /dashboard 端点,然后是所有这些嵌套端点。稍后我计划添加更多与 /dashboard 并行的顶级端点(例如 /widget)

4

0 回答 0