I have the following
var comp1 = React.createClass({
render: function() {
return (
<div>
<div class="content">
<p> information here ..</p>
</div>
</div>
);
}
});
var comp2 = React.createClass({
render: function() {
return (
<div>
<div className="content">
<p>information here</p>
</div>
</div>
)
}
});
How do I require comp1 in another test file
I added module.exports at the end of the file and required as
var myComponents = require('../js/components/App.js').comp1
But get the following error
- TypeError: Cannot read property 'exports' of undefined
Aucun commentaire:
Enregistrer un commentaire