Skip to content

Commit e9bde3b

Browse files
authored
fix Readme.md (#95)
1 parent 525c4e2 commit e9bde3b

File tree

1 file changed

+11
-24
lines changed

1 file changed

+11
-24
lines changed

README.md

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,7 @@ class App extends React.Component {
7070
export default withTheme(App);
7171
```
7272

73-
You can also use the [hooks](https://reactjs.org/docs/hooks-intro.html) based API:
74-
75-
```js
76-
function App() {
77-
const theme = useTheme();
78-
79-
return <div style={{ color: theme.primaryColor }}>Hello</div>;
80-
}
81-
```
82-
83-
### Usage
73+
Another usage for functional component:
8474

8575
```js
8676
const App = ({ theme }) => (
@@ -92,6 +82,16 @@ const App = ({ theme }) => (
9282
export withTheme(App);
9383
```
9484

85+
You can also use the [hooks](https://reactjs.org/docs/hooks-intro.html) based API:
86+
87+
```js
88+
function App() {
89+
const theme = useTheme();
90+
91+
return <div style={{ color: theme.primaryColor }}>Hello</div>;
92+
}
93+
```
94+
9595
### Injected props
9696

9797
It will inject the following props to the component:
@@ -194,19 +194,6 @@ type WithThemeType<Theme> = React.ComponentType<{ theme: Theme }>
194194

195195
Higher Order Component which takes your component as an argument and injects `theme` prop into it.
196196

197-
## Applying a custom theme to a component
198-
199-
If you want to change the theme for a certain component, you can directly pass the theme prop to the component. The theme passed as the prop is merged with the theme from the Provider.
200-
201-
```js
202-
import * as React from 'react';
203-
import MyButton from './MyButton';
204-
205-
export default function ButtonExample() {
206-
return <MyButton theme={{ roundness: 3 }}>Press me</MyButton>;
207-
}
208-
```
209-
210197
#### `useTheme`
211198

212199
**type:**

0 commit comments

Comments
 (0)