react-jss
Advanced tools
Comparing version 8.3.2 to 8.3.3
@@ -0,1 +1,5 @@ | ||
## 8.3.3 / 2018-02-12 | ||
- Add docs about fn values and rules | ||
## 8.3.2 / 2018-02-12 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "react-jss", | ||
"version": "8.3.2", | ||
"version": "8.3.3", | ||
"description": "JSS integration with React", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -6,11 +6,7 @@ # JSS integration with React | ||
<a target='_blank' rel='nofollow' href='https://app.codesponsor.io/link/yHSURRBaaXYK5KyrNZXn4iHe/cssinjs/react-jss'> | ||
<img alt='Sponsor' width='888' height='68' src='https://app.codesponsor.io/embed/yHSURRBaaXYK5KyrNZXn4iHe/cssinjs/react-jss.svg' /> | ||
</a> | ||
React-JSS provides components for [JSS](https://github.com/cssinjs/jss) as a layer of abstraction. JSS and [presets](https://github.com/cssinjs/jss-preset-default) are already built in! Try it out in the [playground](https://codesandbox.io/s/j3l06yyqpw). | ||
The benefits are: | ||
Benefits compared to lower level core: | ||
- Theming support out of the box. | ||
- Theming support. | ||
- Critical CSS extraction. | ||
@@ -20,2 +16,3 @@ - Lazy evaluation - sheet is created only when the component will mount. | ||
- A Style Sheet gets shared between all elements. | ||
- Function values and rules are updated automatically with props. | ||
@@ -75,2 +72,32 @@ ## Table of Contents | ||
### Dynamic values | ||
You can use [function values](https://github.com/cssinjs/jss/blob/master/docs/json-api.md#function-values), function rules and observables out of the box. Function values and function rules will receive a props object once component receives new props or mounts first time. | ||
```js | ||
const styles = { | ||
button: { | ||
background: props => props.color | ||
}, | ||
label: (props) => ({ | ||
display: 'block', | ||
fontWeight: props.fontWeight | ||
}) | ||
} | ||
const Button = ({classes, children}) => ( | ||
<button className={classes.button}> | ||
<span className={classes.label}> | ||
{children} | ||
</span> | ||
</button> | ||
) | ||
Button.defaultProps = { | ||
fontWeight: 'bold', | ||
color: 'red' | ||
} | ||
``` | ||
### Theming | ||
@@ -77,0 +104,0 @@ |
1085657
408