To read more articles like this, visit my blog
React is very unopinionated about how things should be structured. This is exactly why it’s our res...
For further actions, you may consider blocking this person and/or reporting abuse
Using "style" intristic prop is a huge source of misstyling. Imagine you have 35 div's with same styling and you need to change just one or two properties of it. Writing a CSS class is way more better and convenient.
That was my initial thought as well.
If anyone would be willing to answer my questions about the seventh point in the article "Put CSS in JavaScript". I never understood why is JavaScript styling more sought after as CSS styling in React development. In my experience when I split the application into manageable components and pages CSS becomes much more manageable as pure JavaScript styling or styled components, even without introducing SCSS. And this rabbit hole just becomes even deeper when we introduce a component library such as Material UI. Why do they bother introducing quadrillion ways of styling their components instead of making it simpler with CSS styling, it just doesn't make any sense to me.
Good article dood!
I love this article. Now a days instead of writing code, write a code with best practice is a far one.
I also share my experience and best practices in typescript and javascript to everyone for learning.
Keep it up!
Yes... best practices are kindof lights in a runway.... not the runway itself.
And in my experience, yes you can always use the linter and prettier to fix most things.
But does it hurt to know why these rules are there in the first place? :)
Really good tips mate.
Keep the good work ;) !
Great Post Faisal!❤👋
I Like how you explained with examples! 👏
Agreed. But it's hard to prove these things :P
Use memo in the early stage of development is anti-pattern and might cause you trouble. So, use it when you're really needed it.
I agree... this is just nice to know that you have it in your arsenal... when you need it.
Thank you for this nice article!
I have one question about point 7 though:
I always keep my JS separate from my CSS, so I put everything in its own file.
This, to me, feels like a nice separation of concerns and I found that there are quite a few articles that criticize CSS-in-JS:
dev.to/srmagura/why-were-breaking-...
dev.to/xantregodlike/css-in-js-why...
freecodecamp.org/news/you-dont-nee...
dev.to/macsikora/css-in-js-did-we-...
What is your stance regarding this topic? :)
Yes... but at the same time libraries like tailwind css has become much more popular...
I think this can vary from person to person. If separating css works for your project's scale and improves productivity, then why not?
There is no silver bullet! :D