Skip to content

Commit 6877787

Browse files
committed
Updates code examples
1 parent 553d2d1 commit 6877787

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ return <Button disabled={!isEnabled} />
8282

8383
/* Good */
8484
const isDisabled = (itemsCount <= 3)
85-
return <Button disabled={isDisabled} />)
85+
return <Button disabled={isDisabled} />
8686
```
8787

8888
---
@@ -280,9 +280,12 @@ function shouldUpdateUrl(url, expectedUrl) {
280280
Represent minimum or maximum value. Used when describing boundaries or limits.
281281

282282
```js
283-
function PostsList() {
284-
this.minPosts = 3
285-
this.maxPosts = 10
283+
/**
284+
* Renders random amount of posts within
285+
* the given min/max boundaries.
286+
*/
287+
function renderPosts(posts, minPosts, maxPosts) {
288+
return posts.slice(0, randomBetween(minPosts, maxPosts))
286289
}
287290
```
288291

@@ -294,8 +297,8 @@ function fetchPosts() {
294297
const prevPosts = this.state.posts
295298

296299
const fetchedPosts = fetch('...')
297-
const nextPosts = prevPosts.merge(fetchedPosts)
300+
const nextPosts = concat(prevPosts, fetchedPosts)
298301

299-
return this.setState({ posts: nextPosts })
302+
this.setState({ posts: nextPosts })
300303
}
301304
```

0 commit comments

Comments
 (0)