react module css with typescript code example
Example: 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
// 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;
}