Skip to content

Commit

Permalink
Load todos from rxdb
Browse files Browse the repository at this point in the history
  • Loading branch information
gautambt committed Jan 1, 2020
1 parent c25d506 commit d6288b2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/components/Todo/TodoListWrapper.js
Expand Up @@ -9,6 +9,20 @@ class TodoListWrapper extends Component {
todos: []
}

rxSubs = []

async componentDidMount() {
const sub = this.props.db.todos.find()
.sort('createdAt').$.subscribe(todos => {
if (!todos) {
return;
}

this.setState({todos});
});
this.rxSubs.push(sub);
}

render() {
return (
<div className="todoWrapper">
Expand Down

0 comments on commit d6288b2

Please sign in to comment.