A
A
ar52016-05-04 17:26:23
css
ar5, 2016-05-04 17:26:23

How to work in React with css?

Hello, tell me how to load the style file correctly? I am using webpack. Maybe there are articles on which you studied this side of React

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RubaXa, 2016-05-04
@ar5

import React from "react";
import styles from "./button.css";
 
export default class Button extends React.Component {
  render() {
    return (
      <button className={styles.btn}>
        <span className={styles.icon}>
          <Icon name={this.props.icon}/>
        </span>
        <span className={styles.text}>{this.props.value}</span>
      </button>
    );
  }
}

Or https://github.com/gajus/react-css-modules

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question