How Should I Style My React Application?
Manu Arora / September 14, 2020
1 min read •
This is a test blog and I'm testing seriously 😂.
Vanilla CSS
Vanilla CSS Code snippet
index.html
<h1 class="header">Welcome</h1>
index.css
.header {
font-size: 32px;
}
Sample bullet points with strong tags.
- Reusability. It's easy to create append-only stylesheets that become very complex.
- Global Namespace. Since CSS has a global namespace, you can unintentionally target too many elements.
- Colocation. It's hard to modularize your CSS, which makes it difficult to delete code safely.
Sample Link CSS pre-processors.
_base.scss
$font-stack: Helvetica, sans-serif;
$primary-color: #333;
body {
font: 100% $font-stack;
color: $primary-color;
}
_header.scss
@use 'base';
.header {
font-size: 32px;
}
Sample Heading
const HomeContainerWrapper = styled.div`
padding: 8px;
font-weight: bold;
color: white;
background: blue;
`;
<HomeContainerWrapper>
Hello
</HomeContainerWrapper>
// Forget about naming
<Box
padding={3}
fontWeight='bold'
color='white'
bg='blue'
>
Hello
</Box>
Pros and Cons Card Embedded as React Components
Vanilla CSS
You might use vanilla CSS if...
You don't want to add a toolchain. Vanilla CSS works with every browser & language.
You might not use vanilla CSS if...
You're building a large web application.
Want to hire me as a freelancer? Let's discuss.
Drop your message and let's discuss about your project.
Chat on WhatsAppDrop in your email ID and I will get back to you.