Skip to content

Commit dab4781

Browse files
committed
no-context: remove es6 destructuring from docs
1 parent 83b94d5 commit dab4781

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

docs/rules/no-context.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,21 @@ class Button extends React.Component {
1111
render() {
1212
return (
1313
<button style={{background: this.context.color}}>
14-
{this.props.text}
14+
{this.props.children}
1515
</button>
1616
);
1717
}
1818
}
19-
Button.propTypes = {
20-
text: React.PropTypes.string
21-
};
2219
Button.contextTypes = {
2320
color: React.PropTypes.string
2421
};
2522
```
2623

2724
```jsx
28-
const Button = ({text}, context) =>
25+
const Button = (props, context) =>
2926
<button style={{background: context.color}}>
30-
{text}
27+
{props.children}
3128
</button>;
32-
Button.propTypes = {
33-
text: React.PropTypes.string
34-
};
3529
Button.contextTypes = {
3630
color: React.PropTypes.string
3731
};
@@ -44,24 +38,22 @@ class Button extends React.Component {
4438
render() {
4539
return (
4640
<button style={{background: this.props.color}}>
47-
{this.props.text}
41+
{this.props.children}
4842
</button>
4943
);
5044
}
5145
}
5246
Button.propTypes = {
53-
text: React.PropTypes.string,
5447
color: React.PropTypes.string
5548
};
5649
```
5750

5851
```jsx
59-
const Button = ({text, color}) =>
60-
<button style={{background: color}}>
61-
{text}
52+
const Button = (props) =>
53+
<button style={{background: props.color}}>
54+
{props.children}
6255
</button>;
6356
Button.propTypes = {
64-
text: React.PropTypes.string,
6557
color: React.PropTypes.string
6658
};
6759
```

0 commit comments

Comments
 (0)