Is there a faster/more efficient way of declaring multiple variables in react native? Instead of
let foo = 'foo';
let bar = 'bar';
let foobar = 'foobar';
Obviously not problem for three variables, but for bigger sets of variables, is there a better way?
"Faster"? You've determined there's a performance bottleneck here?!
In any case, you can declare multiple variables:
But this is JS 101 and trivially searchable. What are you really asking?
Also, if you have a "large" number of variables, I suspect the problem is more systemic, and you're missing multiple types of refactorings.
This is more of a general JS syntax question.
Depending on your use case, you can just destructure an array as such:
const [ foo, bar, foobar ] = [ 'foo', 'bar', 'foobar' ]
Note that these are constants, having a lot of variables in a scope makes it poorly readable. See here for more