Skip to content

Instantly share code, notes, and snippets.

@koistya
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save koistya/a834b021f4e9f93d8cda to your computer and use it in GitHub Desktop.

Select an option

Save koistya/a834b021f4e9f93d8cda to your computer and use it in GitHub Desktop.
Which naming convention do you use when create React components?
export class ComponentA {
render() {
return <form onSubmit={this.handleSubmit}>...</form>;
},
handleSubmit(e) {
// TODO: handle submit
}
}
export class ComponentA {
render() {
return <form onSubmit={this._handleSubmit}>...</form>;
},
_handleSubmit(e) {
// TODO: handle submit
}
}
export class ComponentC {
render() {
return <form onSubmit={this._onSubmit}>...</form>;
},
_onSubmit(e) {
// TODO: handle submit
}
}
@sergeylaptev
Copy link
Copy Markdown

Personally prefer first one

@roadmanfong
Copy link
Copy Markdown

I used componentC before, but recently changed to ComponentA.

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