Questions about react-css-modules, a higher-order React component that abstracts CSS Modules integration.
Questions tagged [react-css-modules]
298 questions
121
votes
7 answers
How to apply global styles with CSS modules in a react app?
I'm currently using CSS Modules with React for my styling. So each of my components is importing in it's component specific css file, like so:
import React from 'react';
import styles from './App.css';
const example = () => (

dace
- 5,819
- 13
- 44
- 74
36
votes
10 answers
How can I style react-datepicker?
I'm using webpack, react-datepicker and have managed to import its css with the provided css module.
import 'react-datepicker/dist/react-datepicker-cssmodules.css
The component looks fine and dandy, but now I want to make it full width like the…

Sebastian Patten
- 7,157
- 4
- 45
- 51
28
votes
6 answers
React: Hide a Component on a specific Route
New to React:
I have a Component that I want to hide only when the user visit a specific page.
The way I designed my app so far is that the Component is not re-rendered when navigating, only the page content is, so it gives a…

Yannick
- 1,550
- 4
- 18
- 27
26
votes
4 answers
Workaround to add className to Fragment in React
I am trying to create a stateless component in React with the sole purpose of acting as a reusable wrapper. I am also using CSS Modules because I want to have fully modular CSS.
The thing is I don't want to add unnecessary elements (and even more so…

NTP
- 361
- 1
- 3
- 11
26
votes
2 answers
CSS module hover styles when inside another module
In a React/Webpack app with CSS modules I have a module .card in its own .scss file and another module named .stat which is a content to be shown in the .card.
What I need to achieve the following, but int the 'css-modules' way:
.card:hover .stat…

Spadar Shut
- 15,111
- 5
- 47
- 54
24
votes
8 answers
How to customise react-bootstrap components?
What is the best way to override css classes/customise react-bootstrap components? - (I have read the docs, and unless I am missing something, this isn't covered).
From what I have read, it seems like it's a choice between inline styles (radium) and…

AloeVeraForty
- 973
- 2
- 7
- 10
22
votes
2 answers
CSS Modules - referencing classes from other modules
I have understood the concept of CSS modules so much that I am convinced that I do not want to do anything else that that for the future.
Currently I am trying to refactor an existing app to use CSS modules, the app has used classic sass with BEM…

hurrtz
- 1,871
- 1
- 19
- 34
20
votes
3 answers
JSX element type does not have any construct or call signatures
I'm using this simple React element on the left as my root element on the page in the right.
How do I fix the error shown?

Richard
- 14,798
- 21
- 70
- 103
20
votes
5 answers
Use CSS Modules in React components with Typescript built by webpack
I want to use the css-loader with the 'modules' option of webpack in a React application written in Typescript. This example was my starting point (they are using Babel, webpack and React).
webpack config
var webpack=require('webpack');
var…

Shady
- 794
- 2
- 8
- 23
19
votes
1 answer
Css Loader vs Style Loader Vs Sass-Loader
I was little confused in differentiating sass-loader and css-loader while using import statement. As per my knowledge css loader resolve import statment(@import) and style-loader works on injecting style dynamically on your page. I am also using…

Bharat Sewani
- 628
- 2
- 10
- 18
16
votes
2 answers
Inject CSS Modules to Per-Component Style Elements (for portability to shadow root)
TL:DR
How can I get CSS of React components to work inside of a shadow root, while keeping the
encapsulation benefits of CSS Modules class? I'd like to insert per-component