doesn't work properly with react-css-modules
See original GitHub issueOnly inner styleName
compiles to ‘class’, but inners not. You can see that div-2
value has stylename
attribute, but should class
as div-1
.
Component code:
import React, { Component } from 'react';
import CSSModules from 'react-css-modules';
import styles from './styles.css';
@CSSModules(styles)
export default class App extends Component {
render() {
return (
<div styleName="div-1">
<div styleName="div-2">
Big square should be red; <br /> Small square should be black.
</div>
</div>
);
}
}
styles.css:
.div-1 {
width: 500px;
height: 500px;
background: red;
}
.div-2 {
width: 200px;
height: 200px;
background: black;
color: white;
}
How it looks:
How it should:
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
CSS modules not working for react version 16.6.0
Not working with React 17.0.1. The only way to make it work is Changing to UpperCase all the css classes in the css...
Read more >Using CSS Modules in React - OpenReplay Blog
Since I started utilizing React Typescript with CSS Modules, I have run into this problem. To begin using CSS Modules in a React...
Read more >Solving the React Error: Not Picking Up CSS Style | Pluralsight
Here, the CSS file is saved outside the src folder, so the compiler failed to import it. To make this code work, you...
Read more >A complete guide to CSS Modules in React (Part-1) - codeburst
Polluting the global space with CSS specific to a module or component brings with it a lot of overheads in terms of maintenance....
Read more >Using CSS modules in React - Bootcamp
If you are relatively new to CSS, you may or may not have encountered the significant problem that occurs as an application's style...
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 FreeTop 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
Top GitHub Comments
so sad, hoped it to be fixed… =/
It’s very verbose to write
styles
every time, css-modules allows to write it only once, that’s why I use it. Will be very great for me if this will be fixed, I want to try preact in production. Thanks.