Questions tagged [react-css-modules]

Questions about react-css-modules, a higher-order React component that abstracts CSS Modules integration.

219 questions
74
votes
6 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 = () => (
hidace
  • 3,969
  • 6
  • 36
  • 61
23
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
  • 13,513
  • 5
  • 39
  • 51
22
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
  • 303
  • 1
  • 2
  • 11
20
votes
4 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,060
  • 3
  • 12
  • 25
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
  • 9,237
  • 13
  • 60
  • 88
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
  • 764
  • 2
  • 7
  • 22
19
votes
5 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
  • 6,318
  • 4
  • 36
  • 45
16
votes
3 answers

Update CSS Module variables from Javascript

I'm using a (now older) version of react-boilerplate which came with CSS Modules. What's nice about them is that you can create variables and import them in other CSS files. Here's my colors.css file :root { /* Status colors */ --error:…
NateW
  • 2,434
  • 4
  • 22
  • 40
14
votes
2 answers

React + Reactstrap + CSS Modules + Webpack

I've been looking how I can combine the following : ReactJS + ReactStrap and CSS-Modules (react-css-modules and/or boostrap-css-modules), however, I can't seem to piece the three modules together to achieve the desired effect (or find any help…
teh0wner
  • 1,373
  • 6
  • 16
  • 33
14
votes
4 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…
13
votes
3 answers

How to use React Module CSS in Meteor 1.3 beta

EDIT: Meteor 1.3 release is out and a npm package is about to be released allowing a direct use of CSS modules without Webpack I would like to use https://github.com/gajus/react-css-modules in Meteor 1.3 via NPM. But the readme says to use Webpack.…
dagatsoin
  • 2,337
  • 5
  • 23
  • 48
12
votes
0 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