cssinjs/jss

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

开放

#1,319 创建于 2020年3月22日

 (1 条评论) (0 个反应) (0 位负责人)JavaScript (434 个派生)batch import
bughelp wanted

仓库指标

星标
 (7,000 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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

贡献者指南