Answer the question
In order to leave comments, you need to log in
React.js: Why might a component not render?
Hi
there are a couple of components:
MessageList
pastebin.com/XNs3a3kv
import React, {Component} from 'react';
import Message from './Message.jsx';
export default class MessageList extends Component{
render(){
return (
<div className="message-list">
{
this.props.asd.map((cur) => {
return (
<Message id={cur.id} text={cur.text}/>
);
})
}
</div>
);
}
}
import React, {Component} from 'react';
export default class Message extends Component {
render() {
console.log(this.props);
return (
<div key={this.props.id} className="row" style={{borderBottom: 'solid black 1px'}}>
<div className="col-lg-11">
{this.props.text }
</div>
<div className="col-lg-1">
{(new Date()).toLocaleTimeString()}
</div>
</div>
);
}
};
Answer the question
In order to leave comments, you need to log in
The problem was in running Firebug. I do not know how it affects, but with Firebug turned off, everything is rendered.
Also (plus what you have already been answered), it is possible that the ./Message.jsx
export default is incorrect in the component.
If export is specified there without default , then it means that you need to import with curly braces, and the name in the import must match the name in the export. (e.g. import { Message } from ... )
ps attach the code of the Message component
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question