React Router路由解決方案
?React Router 一個(gè)用于 React.js 的路由解決方案(routing solution)。它輕松可以同步你的 app 和 URL,同時(shí)給嵌套,轉(zhuǎn)換,和服務(wù)端渲染一流的支持。
特性:
-
嵌套視圖映射到嵌套路由
-
模塊化構(gòu)建路由層級
-
同步和異步轉(zhuǎn)移掛鉤
-
轉(zhuǎn)換中止/重定向/重試
-
動(dòng)態(tài) segments
-
查詢參數(shù)
-
當(dāng)
.active類的路由活動(dòng)時(shí)可以自動(dòng)鏈接 -
Multiple root routes
-
Hash 或 HTML5 歷史 (含備份) URLs
-
聲明重定向路由
-
聲明未找到路由
-
瀏覽器滾動(dòng)行為帶有轉(zhuǎn)變效果
示例:
var routes = (
);
Router.run(routes, function (Handler) {
React.render(, document.body);
});
// Or, if you'd like to use the HTML5 history API for cleaner URLs:
Router.run(routes, Router.HistoryLocation, function (Handler) {
React.render(, document.body);
});
評論
圖片
表情
