Says my state
is like this:
{
item:{
a:'a',
b:'b'
}
}
Then I'm able to pull a
from item by doing:
const { a } = this.state.item
but can pull dynamically using {}
of es6
?
For example const { variable } = this.state.item
, where variable
can be a
or b
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…