Considering i got a such code:
type RouteConfig = {
path: string;
text: string;
routes?: RouteConfig[];
};
const routes: RouteConfig[] = [
{
path: "/",
text: "home"
},
{
path: "/user",
text: "user",
routes: [
{
path: "/user/info",
text: "user info"
},
{
path: "/user/books",
text: "user books"
}
]
}
];
const routeEntries = ["/", "/user", "/user/info", "/user/books"]; // ?? how to get it Programmatically instead of hard coding.
The routes is a tree-like nested object array, each node might contains sub routes node.
The question is simple, how do i get routeEntries based on existed routes defined above?