Skip to content

Commit b555ba6

Browse files
committed
Update README.md for injectStyled
1 parent 253a136 commit b555ba6

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,21 @@ const PrimaryButton = styled(Button, {
3131
Using base Style Sheet we can share classes between styled primitives.
3232

3333
```js
34-
import { Styled } from 'styled-jss'
35-
import injectSheet from 'react-jss'
34+
import { Styled, injectStyled } from 'styled-jss'
3635

3736
// Base styles, like a regular jss object.
3837
const styled = Styled({
3938
root: {
40-
margin: 10
39+
margin: 10,
40+
'& $baseButton': {
41+
fontSize: 16
42+
}
4143
},
4244
baseButton: {
43-
padding: 10
45+
padding: 10,
46+
'& + &': {
47+
marginLeft; 10
48+
}
4449
}
4550
})
4651

@@ -58,11 +63,12 @@ const PrimaryButton = styled(NormalButton, {
5863
// One can use classes AND styled primitives.
5964
const MyComponent = ({classes}) => (
6065
<div className={classes.root}>
66+
<NormalButton>normal button</NormalButton>
6167
<PrimaryButton>primary button</PrimaryButton>
6268
</div>
6369
)
6470

65-
const MyStyledComponent = injectSheet(styled.styles)(MyComponent)
71+
const MyStyledComponent = injectStyled(styled)(MyComponent)
6672
```
6773

6874
### With custom JSS setup:

0 commit comments

Comments
 (0)