react-router实战之动态侧边栏

 

1.简介

 

有时需要侧边栏内容随着路由而改变

 

2.实例

 

const routes = [
    {
      path: "/",
      exact: true,
      sidebar: () => 
home!
, main: () =>

Home

}, { path: "/bubblegum", sidebar: () =>
bubblegum!
, main: () =>

Bubblegum

}, { path: "/shoelaces", sidebar: () =>
shoelaces!
, main: () =>

Shoelaces

} ]; function App() { return (

你可能感兴趣的:(money,react,#,react)