Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit d3d6eee

Browse files
committed
Move default contacts into App component as state
1 parent b7b51c9 commit d3d6eee

1 file changed

Lines changed: 23 additions & 22 deletions

File tree

src/App.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
import React, { Component } from 'react'
22
import ListContacts from './ListContacts'
33

4-
const contacts = [
5-
{
6-
id: 'tyler',
7-
name: 'Tyler McGinnis',
8-
handle: '@tylermcginnis',
9-
avatarURL: 'http://localhost:5001/tyler.jpg'
10-
},
11-
{
12-
id: 'karen',
13-
name: 'Karen Isgrigg',
14-
handle: '@karen_isgrigg',
15-
avatarURL: 'http://localhost:5001/karen.jpg'
16-
},
17-
{
18-
id: 'richard',
19-
name: 'Richard Kalehoff',
20-
handle: '@richardkalehoff',
21-
avatarURL: 'http://localhost:5001/richard.jpg'
22-
},
23-
]
24-
254
class App extends Component {
5+
state = {
6+
contacts: [
7+
{
8+
id: 'tyler',
9+
name: 'Tyler McGinnis',
10+
handle: '@tylermcginnis',
11+
avatarURL: 'http://localhost:5001/tyler.jpg'
12+
},
13+
{
14+
id: 'karen',
15+
name: 'Karen Isgrigg',
16+
handle: '@karen_isgrigg',
17+
avatarURL: 'http://localhost:5001/karen.jpg'
18+
},
19+
{
20+
id: 'richard',
21+
name: 'Richard Kalehoff',
22+
handle: '@richardkalehoff',
23+
avatarURL: 'http://localhost:5001/richard.jpg'
24+
},
25+
]
26+
}
2627
render() {
2728
return (
2829
<div>
29-
<ListContacts contacts={contacts} />
30+
<ListContacts contacts={this.state.contacts} />
3031
</div>
3132
)
3233
}

0 commit comments

Comments
 (0)