Already done
- npm install -save prop-types
- import PropTypes from 'prop-types';
- npm install --save react-router
- import {Router, Route, Link} from 'react-router';
I have done everything but I can not do it.
ContactCreate.class
import React from 'react';
import PropTypes from 'prop-types';
import { Router, Route, Link } from 'react-router';
/*skip*/
ContactCreate.propTypes ={
onCreate : React.PropTypes.func
};
package.json
I tried everything that other people have put into the solution but the result was the same. There seems to be no problem with the code, but I do not know what the problem is.
Contact.js
constructor(props) {
super(props);
this.state = {
/*skip*/
this, handleCreate = this.handleCreate.bind(this);
}
handleCreate(contact) {
this.setState({
contactData: update(this.state.contactData, { $push: [contact] })
});
}
/*skip*/
render() {
/*skip*/
return (
<div>
<h1>Contacts</h1>
<input
name="keyword"
placeholder="Search"
value={this.state.keyword}
onChange={this.handleChange}
/>
<div>{mapToComponents(this.state.contactData)}</div>
<ContactDetails
isSelected={this.state.selectedKey != -1}
contact={this.state.contactData[this.state.selectedKey]}
/>
<ContactCreate
onCreate={this.handleCreate}
/>
</div>
);
}
