Is there an official style guide or naming convention for React based projects?

前端 未结 5 1496
情歌与酒
情歌与酒 2021-01-04 04:42

I\'m setting up a React project with my team that will use mobX as state manager, plus TypeScript.

I\'ve seen a common pattern in the casing and naming patterns in R

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-04 05:16

    There is no official guide. The reason why most projects adopt PascalCase for react components is to mimic the main export of that file. React components are PascalCased by convention, and when using jsx pascal casing becomes mandatory (only Capitalised first letter becomes mandatory actually). cameCase or kebab-case for the remaining files is just following what is also the more common preference for javascript projects in general.

提交回复
热议问题