CSS 模块的 React 服务器端渲染 [英] React Server side rendering of CSS modules

查看:43
本文介绍了CSS 模块的 React 服务器端渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前对于带有 React 组件的 CSS 的做法似乎是使用 webpack 的 style-loader 将其加载到页面中.

The current practice for CSS with React components seems to be using webpack's style-loader to load it into the page in.

import React, { Component } from 'react';
import style from './style.css';

class MyComponent extends Component {
    render(){
        return (
            <div className={style.demo}>Hello world!</div>
        );
    }
}

通过这样做,样式加载器将一个