cssinjs / cssinjs/jss

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

Open
#1,319 1 comment 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

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

```js
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.