diff --git a/docs/intro.md b/docs/intro.md
index da891b7a3..8fbd3bc8a 100644
--- a/docs/intro.md
+++ b/docs/intro.md
@@ -10,7 +10,6 @@ If you’re interested in playing around with JSS, you can use an online code pl
- [JSS](https://codesandbox.io/s/z21lpmvv33)
- [React-JSS](https://codesandbox.io/s/j3l06yyqpw)
-- [Styled-JSS](https://codesandbox.io/s/xl89zx8zz4)
## Online Compiler
@@ -82,11 +81,11 @@ document.body.innerHTML = `
```javascript
import React from 'react'
import {render} from 'react-dom'
-import injectSheet from 'react-jss'
+import {createUseStyles} from 'react-jss'
// Create your Styles. Remember, since React-JSS uses the default preset,
// most plugins are available without further configuration needed.
-const styles = {
+const useStyles = createUseStyles({
myButton: {
color: 'green',
margin: {
@@ -104,55 +103,18 @@ const styles = {
myLabel: {
fontStyle: 'italic'
}
-}
-
-const Button = ({classes, children}) => (
-
-)
-
-// Finally, inject the stylesheet into the component.
-const StyledButton = injectSheet(styles)(Button)
-
-const App = () => Submit
-
-render(, document.getElementById('root'))
-```
-
-## Styled-JSS Example
-
-```javascript
-import React from 'react'
-import styled from 'styled-jss'
-
-const Button = styled('button')({
- fontSize: 12,
- color: props => props.theme.textColor
})
-// You can also use curried interface this way.
-const div = styled('div')
-
-const Container = div({
- padding: 20
-})
+const Button = ({children}) => {
+ const classes = useStyles()
+ return (
+
+ )
+}
-// Composition.
-const PrimaryButton = styled(Button)({
- color: 'red'
-})
+const App = () =>
-// Composition with unstyled React Components too.
-const UnstyledButton = () =>
-const Button2 = styled(UnstyledButton)({
- color: 'blue'
-})
-
-// Component Selectors.
-const ButtonContainer = styled(Container)({
- [`& ${PrimaryButton}`]: {
- color: 'green'
- }
-})
-```
+render(, document.getElementById('root'))
+```
\ No newline at end of file
diff --git a/docs/react-jss.md b/docs/react-jss.md
index c4423c581..3633b9dec 100644
--- a/docs/react-jss.md
+++ b/docs/react-jss.md
@@ -1,18 +1,18 @@
# JSS integration with React
-React-JSS integrates [JSS](https://github.com/cssinjs/jss) with React using the new Hooks API as well as a Styled Component API. JSS and the [default preset](https://github.com/cssinjs/jss/tree/master/packages/jss-preset-default) are already built in.
+React-JSS integrates [JSS](https://github.com/cssinjs/jss) with React using the new Hooks API. JSS and the [default preset](https://github.com/cssinjs/jss/tree/master/packages/jss-preset-default) are already built in.
Try it out in the [playground](https://codesandbox.io/s/j3l06yyqpw).
-**HOC based API is deprecated as of v10 and will be removed in v11. HOC specific docs are available [here](./react-jss-hoc.md).**
+**HOC based API is deprecated as of v10 and will be removed in v11. You can still make a lazy migration like described [here](https://reacttraining.com/blog/using-hooks-in-classes/). HOC specific docs are available [here](./react-jss-hoc.md).**
-Benefits compared to using the core JSS package directly:
+### Benefits compared to using the core JSS package directly:
- Dynamic Theming - allows context based theme propagation and runtime updates.
- Critical CSS extraction - only CSS from rendered components gets extracted.
- Lazy evaluation - Style Sheets are created when a component mounts and removed when it's unmounted.
- The static part of a Style Sheet will be shared between all elements.
-- Function values and rules are updated automatically with props as an argument.
+- Function values and rules are updated automatically with any data you pass to `useStyles(data)`. You can pass props, state or anything from context for example.
## Table of Contents
@@ -196,17 +196,18 @@ Usage of `ThemeProvider`:
import React from 'react'
import {createUseStyles, useTheme, ThemeProvider} from 'react-jss'
-const useStyles = createUseStyles(theme => ({
+const useStyles = createUseStyles({
button: {
- background: theme.colorPrimary
+ background: ({theme}) => theme.colorPrimary
},
label: {
fontWeight: 'bold'
}
-}))
+})
const Button = ({children, ...props}) => {
- const classes = useStyles(props)
+ const theme = useTheme()
+ const classes = useStyles({...props, theme})
return (