Answers for "css modules react"

CSS
0

typescript css modules in react

npm install typescript-plugin-css-modules --save-dev

Or if you’re using Yarn, run:

yarn add -D typescript-plugin-css-modules


# Create a new file at the root of the project called styles.d.ts
# (or something similar), and add the following code to it:

// For CSS
declare module "*.module.less" {
  const classes: { [key: string]: string };
  export default classes;
}

// For LESS
declare module "*.module.less" {
  const classes: { [key: string]: string };
  export default classes;
}

// For SCSS
declare module "*.module.scss" {
  const classes: { [key: string]: string };
  export default classes;
}
Posted by: Guest on July-14-2020
0

css modules react

import styles from './Component.module.css'
<Component className={styles.someClassInCssModule}/>
Posted by: Guest on May-16-2021

Code answers related to "css modules react"

Browse Popular Code Answers by Language