CodePanda CodePanda - 2 months ago 4
React JSX Question

React.js How do I use a component in another component?

I am trying to use a component in another component like so in react...

var ContentBox = React.createClass({
render: function () {
return (
<div className="container-fluid">
<div className="box center-block">

var Quotesection = React.createClass({
render:function () {
<ContentBox><h1 className="text-center">Example text</h1></ContentBox>


ReactDOM.render(<ContentBox/>, document.getElementById('app'));

But all I get is the box instead of the box and the Quote inside the box. If anyone can help that would be great.


In the code you provided you're not using Quotesection at all.

Try this instead:

ReactDOM.render(<Quotesection/>, document.getElementById('app'));