Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reactjs code/naming conventions

Does anyone know if exists any official or most accepted reference for React naming conventions to use when we build our applications?

React has a lot of different type of components such as React.Component, directives, services and so on. Wouldn't you agree that having a reference naming convention when we implement them in our applications will make sense?

For example:

If we need to create new component how should we name them like [Something]Component or component[Something] or something else? And same applies for other classes.

Other things I wonder about is if variables/functions that belongs to the scope should have an special prefix or suffix. In some situations it may be useful to have a way to differentiate them from functions and other (none react code).

like image 358
Rajendra Khabiya Avatar asked Mar 14 '18 11:03

Rajendra Khabiya


Video Answer


1 Answers

I'm a big fan of the airbnb React style guide. https://github.com/airbnb/javascript/tree/master/react They also have an overall JS style guide. https://github.com/airbnb/javascript

like image 148
patngo Avatar answered Oct 06 '22 00:10

patngo