this is the complete code for the responsive component:
import React from 'react';
class Chat extends React.Component {
handleSubmit(e) {
e.preventDefault();
this.props.addMessage(this.props.room.id, this.state.message);
this.setState({ message: '' });
}
handleMsgChange(event) {
this.setState({ message: event.target.value });
}
render() {
return (
<div>
<div>{this.props.room.messages.toString()}</div>
<form onSubmit={this.handleSubmit}>
<input
onChange={this.handleMsgChange}
value={this.state.message}
type="text" placeholder="Your message"
/>
<input type="submit" value="Send" />
</form>
</div>
);
}
}
Chat.propTypes = {
addMessage: React.PropTypes.func,
room: React.PropTypes.Object,
};
export default Chat;
and I get the error:
Faulty support type: Chat: prop type is roominvalid; it should be a function, usually from React.PropTypes.
source
share