Skip to content

Instantly share code, notes, and snippets.

@FagnerMartinsBrack
Created February 15, 2018 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FagnerMartinsBrack/7ee7b78699e81deec355880ee808fe88 to your computer and use it in GitHub Desktop.
Save FagnerMartinsBrack/7ee7b78699e81deec355880ee808fe88 to your computer and use it in GitHub Desktop.
(Medium) Front-End Separation
//=============================
// THE API BACK-END PROJECT
//=============================
const todoListPageResponseBody = {
header: 'John Doe',
+ list: [{
+ text: 'Go to shop',
+ striked: true
+ }, {
+ text: 'Buy some clothes',
+ striked: false
+ }, {
+ text: 'Buy food',
+ striked: false
+ }]
+};
// ...
//=============================
// THE CLIENT FRONT-END PROJECT
//=============================
// ...
render() {
const todoListPage = this.props.todoListPage;
return <section>
<h1>{todoListPage.header}</h1>
<ul>
+ {todoListPage.list.map((item) => {
+ return <li>
+ { item.striked ? <strike>{item.text}</strike> : item.text }
- {this.props.todoList.map((item) => {
- return <li className={item.isDone ? 'todo-done' : ''}>
- {item.text}
</li>
})}
</ul>
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment