Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 react-router、redux 和 redux-saga 进行路由需要大量重复代码,请看这里。单条路线21条线路。在我的应用程序中,我有数十条路线,因此以某种方式将其干燥非常重要。否则这个文件routes.js将有 1000 多行。
routes.js
有任何想法吗?
最后我来到了这个。它工作得很好,并且有助于为简单的路线做出 4 行的路线声明,而对于那些使用 sagas 和 childRoutes 的人来说,只需 8 行。