The problem of invalid style is introduced into the application of Dva construction.

Dva build
the first type:

...
import styles from "./index.css";
function Index(){
  return(
    <div className={style.index}><div>
  )
}
export default Index;

second type:

...
import "./index.css";
function Index(){
  return(
    <div className="index"><div>
  )
}
export default Index;

now the first one is effective and the second is invalid. Why is the second invalid?

< hr >

it is possible that css modules is enabled by Dva by default,
if you want < div className= "index" >

to take effect, the style file should look like this:

:global{
    .index{...}
}

if you take a look at your style, it should be antd that covers your style and you just weigh your own style.


roadhog turns on cssmodule


https://dvajs.com/knowledgema.

by default.
Menu