React.js style loader module for webpack
npm install react-style-loaderThis is a fork based on vue-style-loader. Similar to vue-style-loader, you can chain it after css-loader to dynamically inject CSS into the document as style tags.
- manualInject (3.1.0+):
Type: boolean. When importing the style from a js file, by default the style is injected as a side effect of the import. When manualInject is true, the imported style object exposes a __inject__ method, which can then be called manually at appropriate timing. If called on the server, the method expects one argument which is the ssrContext to attach styles to.
``js
import React from 'react'
import styles from 'styles.scss'
export default class App extends React.PureComponent {
componentWillMount() {
if (styles.__inject__) {
styles.__inject__(this.props.staticContext) // staticContext from react-router on server
}
}
render() {
return
- ssrId (3.1.0+):
Type:
boolean. Add data-react-ssr-id attribute to injected