What does the three dots in react do?
发布时间:2020-12-15 07:35:08 所属栏目:百科 来源:网络整理
导读:http://stackoverflow.com/a/41640566/2177408 As you know ... are called spread operator which the name represents it allows an expression to be expanded. var parts = [ 'two' , 'three' ]; numbers 'one' ... parts 'four' 'five' // ["one","two"
http://stackoverflow.com/a/41640566/2177408 As you know var parts = ['two', 'three']; numbers 'one'...parts'four''five' // ["one","two","three","four","five"] And in this case(I'm gonna simplify it). //just assume we have an object like this: person{ name:'Alex' age 35} This: <Modal {...person} title='Modal heading' animation{false} /> is equal to name{person.name}age{person.age} So in short,it's aneatshort-cut,we can say. |