React Transferring Props except one

前端 未结 5 1970
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-23 13:05

React suggests to Transfer Props. Neat!

How can I transfert all but one?

render: function(){
  return (

        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-23 13:52

    You can use the following technique to consume some of the props and pass on the rest:

    render() {
      var {one, ...other} = this.props;
      return (
        
          
        
      );
    }
    

    Source

提交回复
热议问题