我在尝试将带有键的对象转换为 javascript 中的对象数组时遇到问题
将输入对象转换为类似于所需输出数组的结构的最佳方法是什么?
const routes = {
Home: {
screen: HomeScene,
path: '/'
},
About: {
screen: AboutScreen,
path: '/about'
}
};
const output_routes =
[{
component: Layout,
routes: [{
path: '/',
exact: true,
component: HomeScene,
},
{
path: '/about',
exact: true,
component: AboutScreen,
}],
}];