Created
October 23, 2019 22:30
-
-
Save jdob/d65fac889429a06042c545d96debbfac to your computer and use it in GitHub Desktop.
This file contains 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
App.js | |
----- | |
import React from 'react'; | |
import FileUpload from './components/FileUpload.js'; | |
import Prof from './components/Prof' | |
import './App.css'; | |
const App = () => ( | |
<div className='container mt-4'> | |
<h4 className='display-4 text-center mb-4'> | |
<i className='title1' /> Upload Coupon | |
</h4> | |
{/* <FileUpload /> */} | |
<Prof /> | |
</div> | |
); | |
export default App; | |
----- | |
components/Prof.js | |
----- | |
import React, { Component } from 'react' | |
class Prof extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
message: [], | |
}; | |
this.loadData = this.loadData.bind(this) | |
} | |
loadData() { | |
let url = 'http://localhost:5000'; | |
fetch(url).then(results => { | |
return results.text(); | |
}).then(body => { | |
this.setState({message: body}); | |
}); | |
} | |
componentDidMount() { | |
// Initial load | |
this.loadData() | |
} | |
render() { | |
return( | |
<div>{this.state.message}</div> | |
); | |
} | |
} | |
export default Prof; | |
----- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment