Dynamic Object Keys

Dynamic Keys
πŸ‘¨β€πŸ’Ό We need to model error pages where the property name isn't a valid identifier (like status-404).
When the property name is stored in a variable, you can use a computed property name in an object literal:
const key = 'status-404'
const errorPages = {
	[key]: '/not-found',
}
🐨 Open
index.ts
and:
  1. Use computed property names in an object literal
  2. Set values alongside those computed keys

Please set the playground first

Loading "Dynamic Object Keys"
Loading "Dynamic Object Keys"