For example, I import a component from the library:

import Datetime from 'react-datetime' import 'react-datepicker/dist/react-datepicker.css' 

But in the browser, the component is displayed without styles.

    1 answer 1

    First you need to install css-loader

     npm install css-loader --save-dev 

    Then you need to add it to the bootloaders in the webpack configuration

     module.exports = { //... module: { loaders: [ { test: /\.css$/, loader: "style-loader!css-loader" }, //... ] } }; 

    Well, then you can already use css

     import Datetime from 'react-datetime'; import 'react-datepicker/dist/react-datepicker.css'; 
    • I'm not using webpack - Jonny Manowar
    • @JonnyManowar and what are you using? How is the project going? - Ilya
    • I do everything through npm - Jonny Manowar
    • @JonnyManowar then it's time to explore some collector, without it it will only be more difficult. - Ilya
    • but npm needs to understand what to do with it next - Jonny Manowar