Imaging we have a props
, a really large object:
{
"firstname": "John",
"lastname": "Doe",
"age": 11,
"mode: "expert",
"website": "stackoverflow.com"
"protocol": "https",
"job": "dev",
"env": "main",
..... and a lot of key-values pairs coming
}
What usually we are calling to create "component variables":
let {firstname,
lastname,
age,
mode,
website,
protocol,
job,
env
...and a lot of "keys" as variable names} = props
// so we can call variable, {age} for example
I don't like to type all these variables in let {}
, do we have something dynamic to declare "all keys" dynamically? I am not sure it's possible.
Of course I can use {props.firstname}
in my code.
There is a way to create dynamically variables in let {}
scope?
Any help is appreciated.