Last active
April 26, 2017 21:00
-
-
Save spacegauch0/f2275a112b9f82a9857e4d7a6912fd49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import PouchDBChanges from 'react-pouchdb-changes' | |
| import React from 'react' | |
| export default class extends React.Component { | |
| state = { latestDoc: null } | |
| changeHandler = (change) => { | |
| this.setState({ latestDoc: change.doc }) | |
| } | |
| render () { | |
| return( | |
| <div> | |
| <PouchDBChanges | |
| dbUrl='http://couch-01.db.precioslibres.org/precios_claros_dump-01' | |
| changesOpts={{ since: 'now', live: true, include_docs: true }} | |
| onChange={change => this.setState({ latestDoc: change.doc })} | |
| onError={err => this.handleError(err)} | |
| > | |
| <p>{this.state.latestDoc ? this.state.latestDoc.uuid : 'loading...'}</p> | |
| </PouchDBChanges> | |
| </div> | |
| ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment