Really like Vue's solution for css, how about a similar one like this for React?
See original GitHub issueDo you want to request a feature or report a bug? feature
What is the expected behavior? So I really like Vue’s solution for css, how about a similar one like this for React?
// App.js
import Scoped from "scoped-css"
import style from "./App.css"
const App = () =>
<Scoped style={style}>
<div className="App">
<div className="header">
<h2>Welcome to React</h2>
</div>
<p className="intro">
To get started...
</p>
</div>
</Scoped>
//App.css
.App { ... }
.header { ... }
.intro { ... }
CSS will apply to elements of the current component only, and parent component’s styles will not leak into child components.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
The CSS-in-React Landscape
Vue has style tags built right into Single File Components. Same with Svelte. Angular also has a built-in component-scoped styles solution.
Read more >Vue vs React in 2022 - Comparison of Two Most Popular ...
Vue.js and React.js are two popular frontend frameworks in the developer world, switching top spot on the podium each year in the categories ......
Read more >Vue vs React: What is The Best JS Technologies in 2023?
Vue and React are considered the best Javascript framework and library. So it comes as no surprise that many companies use them in...
Read more >I created the exact same app in React and Vue. Here are ...
You'll see that their structures are similar as well. The key difference so far is that the React app has two CSS files,...
Read more >JavaScript Tools: A React and Vue Comparison
Initially, JSX could be a bit of a learning curve for a typical developer. Although JSX is a different approach, it is very...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I think that styled-jsx and CSS Modules already achieve what you’re thinking of.
https://github.com/gajus/babel-plugin-react-css-modules ?