Created
July 11, 2018 20:15
-
-
Save amrfarid140/3be898783e977b8233e9e166eba4648c to your computer and use it in GitHub Desktop.
Main View for the web app
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
import { observer } from 'mobx-react'; | |
import * as React from 'react'; | |
import { AppViewModel } from './AppViewModel'; | |
@observer class App extends React.Component< {model: AppViewModel} ,{}> { | |
public render() { | |
return ( | |
<div> | |
<button onClick={this.props.model.refresh} >Refresh List</button> | |
<button onClick={this.props.model.clearData} >Clear List</button> | |
<ol> | |
{ | |
this.props.model.items | |
.map(item => { | |
return ( | |
<li key={item.name}> | |
<ul> | |
<li>Name: {item.name}</li> | |
<li>Description: {item.description}</li> | |
<li>Link: <a href={item.html_url}>Link</a></li> | |
</ul> | |
</li> | |
); | |
}) | |
} | |
</ol> | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment