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

Commit

Permalink
Move default contacts into App component as state
Browse files Browse the repository at this point in the history
  • Loading branch information
tylermcginnis committed Mar 2, 2018
1 parent b7b51c9 commit d3d6eee
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
import React, { Component } from 'react'
import ListContacts from './ListContacts'

const contacts = [
{
id: 'tyler',
name: 'Tyler McGinnis',
handle: '@tylermcginnis',
avatarURL: 'http://localhost:5001/tyler.jpg'
},
{
id: 'karen',
name: 'Karen Isgrigg',
handle: '@karen_isgrigg',
avatarURL: 'http://localhost:5001/karen.jpg'
},
{
id: 'richard',
name: 'Richard Kalehoff',
handle: '@richardkalehoff',
avatarURL: 'http://localhost:5001/richard.jpg'
},
]

class App extends Component {
state = {
contacts: [
{
id: 'tyler',
name: 'Tyler McGinnis',
handle: '@tylermcginnis',
avatarURL: 'http://localhost:5001/tyler.jpg'
},
{
id: 'karen',
name: 'Karen Isgrigg',
handle: '@karen_isgrigg',
avatarURL: 'http://localhost:5001/karen.jpg'
},
{
id: 'richard',
name: 'Richard Kalehoff',
handle: '@richardkalehoff',
avatarURL: 'http://localhost:5001/richard.jpg'
},
]
}
render() {
return (
<div>
<ListContacts contacts={contacts} />
<ListContacts contacts={this.state.contacts} />
</div>
)
}
Expand Down

1 comment on commit d3d6eee

@tanuj1709
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error state is not defined is coming.

Please sign in to comment.