Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Transferring Props except one

React suggests to Transfer Props. Neat!

How can I transfert all but one?

render: function(){   return (<Cpnt {...this.propsButOne}><Subcpnt one={this.props.one} /></Cpnt>); } 
like image 267
Augustin Riedinger Avatar asked Feb 02 '16 11:02

Augustin Riedinger


Video Answer


1 Answers

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

render() {   var {one, ...other} = this.props;   return (     <Cpnt {...other}>       <Subcpnt one={one} />     </Cpnt>   ); } 

Source

like image 155
villeaka Avatar answered Oct 01 '22 09:10

villeaka