I've installed ReactJS and Babel using npm in my laravel project. They are found in "node_modules" folder created by npm itself. But the problem is my react code doesn't seem to work if I import using this code:
<script src="node_modules/react/react.js"></script>
<script src="node_modules/react-dom/dist/react-dom.js"></script>
<script src="node_modules/babel-core/lib/api/browser.js"></script>
Is the format of the path correct? because if I just import using this type of code for all my imports required for ReactJS:
<script src="http://ift.tt/1KXYNNU"></script>
It seems to work if I just use the internet for getting the packages.
My react code is here:
<div id="myapp"></div>
<!-- JavaScripts -->
<script type="text/babel">
var BuckyComponent = React.createClass({
render: function() {
return(
<h2>{this.props.user} likes to eat {this.props.food}</h2>
);
}
});
React.render(
<div>
<BuckyComponent user="Arth" food="Bacon"/>
<BuckyComponent user="Arth" food="Pork"/>
<BuckyComponent user="Arth" food="Chicken"/>
</div>,
document.getElementById('myapp')
);
</script>
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire