From 4263e556fc889206fee5b22d54a1cd910f4e586b Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Mon, 9 Jul 2018 09:01:51 -0400 Subject: [PATCH] Docs: Clarify components capitalization --- docs/reference/coding-guidelines.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/reference/coding-guidelines.md b/docs/reference/coding-guidelines.md index c28c35ccbd2fd..ca74c69212293 100644 --- a/docs/reference/coding-guidelines.md +++ b/docs/reference/coding-guidelines.md @@ -152,6 +152,16 @@ class Earth { Earth.humans = []; ``` +All `@wordpress/element` Components, including stateless function components, should be named using Class Definition naming rules, both for consistency and to reflect the fact that a component may need to be transitioned from a function to a class without breaking compatibility. + +**Examples:** + +```js +class MyComponent extends Component {} + +function MyComponent() {} +``` + #### Constants An exception to camel case is made for constant values which are never intended to be reassigned or mutated. Such variables must use the [SCREAMING_SNAKE_CASE convention](https://en.wikipedia.org/wiki/Snake_case).