I have the following:
var repos = [{"keya":"vala","keyb":"valb"},{"keya":"vala","keyb":"valb"},{"keya":"vala","keyb":"valb"}]
In my react component code:
var React = require('react');
var Repos = React.createClass({
propTypes: {
username: React.PropTypes.string.isRequired,
repos: React.PropTypes.array.isRequired
},
render: function() {
return (
<div> REPOS<br />
Username: {this.props.username} <br />
Repos: {this.props.repos}
</div>
)
}
});
module.exports = Repos;
I see that:
{this.props.repos} returns the above, but I am getting an error:
Uncaught Error: Invariant Violation: Objects are not valid as a React child... check the render method.
How do I get around this? Is there a way to just output everything without iterating/looping through each one? I know I can do so in AngularJS, but I don't get why react is giving me a hard time.
I am using the newest version of react; I don't think this was a problem with 0.13.