귀속 생 성 플러그 인 루트 (react - router 4.0 이하)

function descRouter(routes) {
    return routes.map((route, i) => {
        if (route.routes) {
            return (
                
                    {descRouter(route.routes)}
                
            );
        } else {
            return ();
        }
    });
}

매개 변수 routes 의 구 조 는 다음 과 같 습 니 다.
[

{    path:'/',

   component: 'InterfaceList',

   routes: [ 

             {   path: 'aaa',


                  component:  'UserList',

              },

              {  path: 'bbb',


                  component:  'ProfileList',

              }

         ]

},
{


   path:'/ABCList',

   component: 'ABCList',

}

]

좋은 웹페이지 즐겨찾기