Skip to content

Instantly share code, notes, and snippets.

@amrfarid140
Created July 11, 2018 20:15
Show Gist options
  • Save amrfarid140/3be898783e977b8233e9e166eba4648c to your computer and use it in GitHub Desktop.
Save amrfarid140/3be898783e977b8233e9e166eba4648c to your computer and use it in GitHub Desktop.
Main View for the web app
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