-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard-review.jsx
42 lines (35 loc) · 937 Bytes
/
card-review.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import React, { Component } from 'react';
import { Link, browserHistory } from 'react-router';
import { createContainer } from 'meteor/react-meteor-data';
import { Cards } from '../../imports/collections/cards';
import CardDetail from './card-detail';
var skip;
const LIMIT = 1;
class CardReview extends Component {
componentWillMount() {
skip = 0;
}
handleButtonClick() {
skip += 1;
Meteor.subscribe('cards', skip, LIMIT);
}
render(){
return (
<div>
<div>
{this.props.cards.map(card =>
<CardDetail key={card._id} card={card} />
)}
</div>
<button onClick={this.handleButtonClick.bind(this)}
className="btn btn-primary">
Next card...
</button>
</div>
);
}
}
export default createContainer(() => {
Meteor.subscribe('cards', skip, LIMIT);
return { cards: Cards.find({}).fetch() };
}, CardReview);