cssinjs/jss

[jss-compose] When composing from a class that takes props, the inheriting class needs props also

Aperta

#1319 aperta il 22 mar 2020

 (1 commento) (0 reazioni) (0 assegnatari)JavaScript (434 fork)batch import
bughelp wanted

Metriche repository

Star
 (7000 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

I have a class that takes props, when I extend it, the extension doesn't work unless the class that extends also takes props.

const useStyles = makeStyles({
  icon: props => ({ // <---------- base class
    fontSize: Number(props.size)
  }),
  successIcon: props => ({
    composes: '$icon', // This works, because it takes props, even though not using them
    color: 'green'
  }),
  failIcon: {
    composes: '$icon',  // This extension should work, but it doesn't
    color: 'red'
  }
})

React-JSS 10.1.1 Material UI 4.9.7

Guida contributor