What does the three dots in react do?

前端之家收集整理的这篇文章主要介绍了What does the three dots in react do?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

http://stackoverflow.com/a/41640566/2177408

As you know...are calledspread operatorwhich the name represents it allows an expression to be expanded.

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.

原文链接:https://www.f2er.com/react/304911.html

猜你在找的React相关文章