Sunday, 17 June 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...