How to use the react-jss.apply function in react-jss

To help you get started, we’ve selected a few react-jss examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cssinjs / react-jss-hmr / src / injectSheet.js View on Github external
export default function injectSheet(...rest) {
  const createHoc = defaultInjectSheet.apply(this, rest)
  return (InnerComponent) => {
    const Jss = createHoc(InnerComponent)

    class HotJss extends Jss {
      componentWillMount() {
        // Note: this will never be called during hot module replacement, so we can
        // use it as a place to store away the SheetManager
        super.componentWillMount()
        managers.set(Object.getPrototypeOf(this), this.manager)
      }

      componentWillReceiveProps(nextProps, nextContext) {
        super.componentWillReceiveProps(nextProps, nextContext)

        const prevManager = managers.get(Object.getPrototypeOf(this))
        const manager = this.manager