import React, { Component } from 'react'; const BTC_URL = 'http://54.213.83.132/hackoregon/http/oregon_individual_contributors/'; export default class App extends Component { constructor(props) { super(props); this.state = { sortOrder: 'ascending', data: [], total: '', }; } async componentDidMount() { let URL = BTC_URL + '5/'; let response = await fetch(URL); let newData = await response.json(); console.log('Our asynch/await data:', newData); // eslint-disable-line no-console this.setState({ data: newData, }); } async componentWillUpdate() { if (this.state.data.length != this.state.total) { let new_URL = BTC_URL + this.state.total + '/'; let response = await fetch(new_URL); let newData = await response.json(); console.log('Our asynch/await data:', newData); // eslint-disable-line no-console this.setState({ data: newData, }); } } onKeyDownHandler(e) { switch (e.key) { case 'Enter': { if (e.target.value === '') { return; } const newTotal = e.target.value; this.setState({ total: newTotal, }); console.log('enter pressed', this.state.total); // eslint-disable-line no-console } } } render() { return (
Ascending / Descending
| # | Payee | Sum |
|---|