I want to know the difference between rscss and bem

1.2k Views Asked by At

I don't understand the difference between RSCSS vs BEM. Someone says RSCSS and someone says BEM.

Pls let me know the difference that

2

There are 2 best solutions below

0
On

When working with RSCSS you should think in components. Each piece of UI should be thought as an individual component.

example:

.signup-form {
   .inputfield {
     ...
   }
   .submitbtn {
     ...

     &.-inverted {
       ..
     }
   }
}

BEM methodology is based on the Block - Element - Modifier system, and here for every element unique selector should be used.

example:

.form { }
.form__input { }
.form__submit { }
.form__submit--wide { }

More about this theme read in this CSS formatting text.

0
On

RSCSS is just BEM extended with some additional thoughts and experience of the crew who created it.

For example RSCSS states

  • one level nesting to ping specificity a bit
  • no double dash / lodash on modifier / elements etc.

you can treat RSCSS as one of BEM modification (with some additional hints).