I have the following object:
const config = {
name: "app",
android: {
name: "app-android",
googleMaps: {
location: "us",
}
}
}
and I want to create a new object dynamicConfig
, which copies the config
object but adding some fields to android.googleMaps
:
const dynamicConfig = {
...config,
android: {
...config.android,
googleMaps: {
...config.android.googleMaps,
endPoint: "some-endpoint",
apiKey: "some-api-key",
}
}
}
Is there any other cleaner way to handle this? Do I have to spread multiple times?