Recently, I encountered an issue with my React code where inline styles were working fine:
render() {
return (
<div style={{ fontSize: 48 }}>LOLOLO</div>
)
}
However, when I tried using index.css
(which defines .me { font-size: 48 }
), it seemed to have no effect:
import styles from './index.css'
render() {
return (
<div className={styles.me}>LILILILALALA</div>
)
}
I'm puzzled by this behavior. Can anyone provide insight into what might be causing this problem?
For reference, here is the content of my tsconfig.json
:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react"
},
"include": [
"src"
]
}