Constructor
const testData = [
{name: "Dan Abramov", avatar_url: "https://avatars0.githubusercontent.com/u/810438?v=4", company: "@facebook"},
{name: "Sophie Alpert", avatar_url: "https://avatars2.githubusercontent.com/u/6820?v=4", company: "Humu"},
];
class App extends React.Component {
constructor(props){
super(props);
this.state = {
profiles: testData,
};
}
// Another option
state = {
profiles : testData,
};
render() {
return (
<div>
<div className="header">{this.props.title}</div>
<Form />
<CardList profile={this.state.profiles}/>
</div>
);
}
}
Other option
s
Comentarios
Publicar un comentario