What do these three dots in React do?

前端 未结 29 2603
不思量自难忘°
不思量自难忘° 2020-11-21 23:53

What does the ... do in this React (using JSX) code and what is it called?



        
29条回答
  •  无人及你
    2020-11-22 00:27

    Spread Attributes used to Pass the multiple Properties in a Simple Way

    { ... this.props } is Holding the property of this.props

    Use of the { ... } Spread Operator with below props

    this.props = 
     { 
        firstName: 'Dan', 
        lastName: 'Abramov', 
        city: 'New York',
        country: 'USA' 
    }
    

    Without { ... } Spread

     
    

    With { ... } Spread

    
    

    Dan Abramov's Tweet about Spread operator (Creator of Redux)

提交回复
热议问题