Reputation: 29
I switched from react to preact but my own components not render successfully maybe for styles
can anyone help me?
//MyComponent.js
import style from "./style.css";
let Component = () => (
<div style={style.home}>
<p>How are you today?</p>
</div>
);
export default Component;
and
//style.css
.home {
margin: 56px 20px;
width: 100%;
}
Upvotes: 1
Views: 1465
Reputation: 21010
CSS Module loader returns class names which you should assign to class
prop instead of style
.
Here is the modified code.
//MyComponent.js
import style from "./style.css";
let Component = () => (
// Use class and not style
<div class={style.home}>
<p>How are you today?</p>
</div>
);
export default Component;
Upvotes: 2