I am struck on a problem trying to Convert a Object with keys to an array of objects in javascript
What is the best way to convert the input Object to resemble the structure of the desiredOutput array?
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,
}],
}];