r/javascript • • Jun 12 '22

How to use bootstrap in React

https://www.devtip.co/how-to-use-bootstrap-in-react/
0 Upvotes

29 comments sorted by

View all comments

18

u/SuperSubwoofer Jun 12 '22

Just don’t?

3

u/b0x3r_ Jun 12 '22

Can you explain why not? I’m just learning web dev and it’s not obvious to me why you wouldn’t

4

u/SuperSubwoofer Jun 13 '22

You can obviously use it, and there’s nothing inherently wrong with it. HOWEVER, as a Front End Dev, using Normalize as a basis and using a mix of Flexbox and CSS grid gives you much granular control.

You can also combine that with CSS variables or a pre-processor like LESS or SASS. My biggest issue with it is once you get into custom client sites, it becomes more of a pain to use then to use your own stylesheets and boilerplates.

3

u/b0x3r_ Jun 13 '22

Thanks! Is it common to use something like sass if you are using a framework like react?

2

u/SuperSubwoofer Jun 13 '22

I’m a WordPress dev, so I use React in a bit of a different capacity, but using a pre processor is agnostic to the framework you are using in my experience. I highly recommend SASS or LESS. It’s more readable and easy to set variables with.

2

u/b0x3r_ Jun 13 '22

I appreciate the advice, there’s so many frameworks out there that’s it difficult as a newcomer to sort out what modern devs are using.

1

u/SuperSubwoofer Jun 13 '22

If you’re completely new, I would recommend vanilla JS, html, and CSS to start then branch into React and pre-processors. You’ll have a solid foundation and learning new frameworks will be much easier.

2

u/[deleted] Jun 13 '22

I feel like sass is in a weird place right now because of evolution of css, where it ends up having conflicting functionality and becomes awkward to use. Like css variables vs sass variables and css functions vs sass functions. You end up mixing them together because they don't completely overlap, which ends up looking like a mess, because some of it needs to be compiled by sass and some should be left as is. And you often have to explicitly tell it which is which with #{} and it's just ugly and hard to type.

Even some syntax is now conflicting, for example using / for division is deprecated in favor of a function because css uses it as a parameter separator in more and more functions.

Overall, I think it's not worth the hassle anymore. Things that it does provide like nested selectors and functions/mixins/modules aren't really that useful with a js framework because you are most likely already scoping your css to your components. So I'd say no, you don't really need it.