cssinjs/jss

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

Open

#1,319 建立於 2020年3月22日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)JavaScript (434 fork)batch import
bughelp wanted

倉庫指標

Star
 (7,000 star)
PR 合併指標
 (30 天內沒有已合併 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

貢獻者指南