Skip to content

Commit 783bbcf

Browse files
committed
Use stateless functional component in dumb example
"Dumb" components like this example seem to be an obvious place to use React 0.14 stateless functional components. This PR changes the example to use one. I don't know if a stateful component was a concious choice, but I would prefer stateless in this situation and I think it should be considered for the example.
1 parent 07504d5 commit 783bbcf

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

docs/quick-start.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,14 @@ It is advisable that only top-level components of your app (such as route handle
4242
Let’s say we have a `<Counter />` “dumb” component with a number `value` prop, and an `onIncrement` function prop that it will call when user presses an “Increment” button:
4343

4444
```js
45-
import { Component } from 'react';
46-
47-
export default class Counter extends Component {
48-
render() {
49-
return (
50-
<button onClick={this.props.onIncrement}>
51-
{this.props.value}
52-
</button>
53-
)
54-
}
45+
import React from 'react'
46+
47+
export default function Counter(props) {
48+
return (
49+
<button onClick={props.onIncrement}>
50+
{props.value}
51+
</button>
52+
)
5553
}
5654
```
5755

0 commit comments

Comments
 (0)