Reputation: 53
I'm experimenting with meteor 1.5 and react 15.6.1.
/client/main.js
import React from 'react';
import { render } from 'react-dom';
import { Meteor } from 'meteor/meteor';
import App from '../imports/app';
Meteor.startup(() => {
render(<App />, document.getElementById('root'));
});
This is the App component:
//imports/app.js
import React, {Component} from 'react'
import Message from './message'
export default class App extends Component {
constructor(props){
super(props);
}
render(){
return(
<Message message="Hello Cowboys" />
)
}
}
And this is my Message dumb component:
// /imports/message.js
import React from 'react';
const Message = (props) =>
<p>{this.props.message}</p>;
export default Message;
The Error I receive is: Uncaught TypeError: Cannot read property 'message' of undefined.
Do you have any Idea why i am receiving this error ?
Upvotes: 0
Views: 99
Reputation: 436
In stateless component you should do this :
import React from 'react';
const Message = (props) =>
<p>{props.message}</p>;
export default Message;
Upvotes: 1