Skip to content

Instantly share code, notes, and snippets.

@c7tincu
Created May 27, 2015 14:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save c7tincu/a25aff277b3773c6d97c to your computer and use it in GitHub Desktop.
Save c7tincu/a25aff277b3773c6d97c to your computer and use it in GitHub Desktop.
// You’d expect this one…
render() {
return (
<button { ...this.props } className={ this.cn + (this.props.className ? ' ' + this.props.className : '') }>
{ this.props.children }
</button>
);
}
// …and this another one…
render() {
return (
<button className={ this.cn + (this.props.className ? ' ' + this.props.className : '') } { ...this.props }>
{ this.props.children }
</button>
);
}
// …to be the same, right!? Well, guess again…
@c7tincu
Copy link
Author

c7tincu commented May 27, 2015

The fragments which differ are { ...this.props } className={ … } vs. className={ … } { ...this.props }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment