forked from rajeshpillai/youtube-react-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppWithModal.js
More file actions
37 lines (34 loc) · 935 Bytes
/
AppWithModal.js
File metadata and controls
37 lines (34 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React, { Component } from 'react';
import withModal from './components/HOC/withModal';
import TodoItem from './features/todo/todo-item';
import './appwithmodal.css';
export default class AppWithModal extends Component {
state = {
todos: [
{id: 1, title: "Learn React"},
{id: 2, title: "Learn Angular"},
{id: 3, title: "Learn Vue"},
{id: 4, title: "Learn Node"},
{id: 5, title: "Learn MongoDB"},
{id: 6, title: "Learn GraphQL"},
{id: 7, title: "Learn Redux"},
{id: 8, title: "Learn .NET Core"},
]
}
render() {
let taskUI = this.state.todos.map((todo) => {
let TodoItemWithModal = withModal(TodoItem);
return (
<TodoItemWithModal key={todo.id} todo={todo} />
);
});
return (
<div>
<h2>HOC - Modal Dialog Demo</h2>
<div className="todo-list">
{taskUI}
</div>
</div>
);
}
}