Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming convention #28624

Closed
MiloosN5 opened this issue Mar 24, 2024 · 1 comment
Closed

Naming convention #28624

MiloosN5 opened this issue Mar 24, 2024 · 1 comment

Comments

@MiloosN5
Copy link

Hello to everyone! I know that naming convention for the React components are not fixed, but I have situation that confuse me. I want my projects to have multiple different buttons. I prefer using BEM naming convention, but I don't know is it good to use for Component naming or just for CSS className? For me, the following will be acceptible:

project/
├── src/
│   ├── components/
│   │   ├── Button/
│   │   │   ├── Button--1.jsx
│   │   │   ├── Button--2.jsx
│   │   │   └── Button--3.jsx

I saw it quite frequently that people use something like "PrimaryButton", "SecondaryButton", but for me this look inexhaustible -> for me better will be "ButtonPrimary", "ButtonSecondary" since the "Button" is BASE.

Also, should BLOCK be used in naming convention instead of MODIFIER, like:

project/
├── src/
│   ├── components/
│   │   ├── Button/
│   │   │   ├── Form__button.jsx
│   │   │   ├── Sidebar__button.jsx
│   │   │   └── Footer__button.jsx
@rickhanlonii
Copy link
Member

Unfortunately, this issue tracker is for reporting bugs in React, and is not a support forum for using React and we don't offer opinions on patterns like naming conventions. We want you to find the answer you're looking for, so we suggest posting one of the Community Forums: https://react.dev/community

@rickhanlonii rickhanlonii closed this as not planned Won't fix, can't repro, duplicate, stale Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants