Skip to content

Commit

Permalink
[docs] shallow: fix reduceRight; add related methods to last
Browse files Browse the repository at this point in the history
 - `reduceRight`: This example is supposed to be of reduceRight and not reduce function.
 - `last`: Added Related Methods
  • Loading branch information
manishdipankar1711 authored and ljharb committed Jul 26, 2018
1 parent 30b7970 commit fe14611
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/api/ShallowWrapper/last.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ Reduce the set of matched nodes to the last in the set.
const wrapper = shallow(<MyComponent />);
expect(wrapper.find(Foo).last().props().foo).to.equal('bar');
```


#### Related Methods

- [`.first() => ShallowWrapper`](first.md)
2 changes: 1 addition & 1 deletion docs/api/ShallowWrapper/reduceRight.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function Foo() {

```jsx
const wrapper = shallow(<Foo />);
const total = wrapper.find(Bar).reduce((amount, n) => amount + n.prop('amount'));
const total = wrapper.find(Bar).reduceRight((amount, n) => amount + n.prop('amount'));
expect(total).to.equal(16);
```

Expand Down

0 comments on commit fe14611

Please sign in to comment.