Sunday, June 17, 2018

javascript - What does "...this.props" mean in ReactJS?




What does {...this.props} mean in this code?





Answer



The {...variable} syntax is called "spread attributes".



What this does is, basically, it takes every property of this.props (or any other passed variable) and applies them to the element.



Example:




props = {className: 'big', href: 'http://example.com'};


// the above line is equal to the following


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...