I'm learning React, and I have a php project set up like this:
In the head of index.php I load:
<script type="text/javascript" src="js/libs/react.js"></script> <script type="text/javascript" src="js/libs/react-dom.js"></script> <script type="text/javascript" src="js/libs/browser.min.js"></script> and at the bottom:
<script type="text/babel" src="jsx/index.jsx"></script> <script> window.onload=function(){ site.init(); }</script> </script> I'm not doing any transpiling. Everything runs fine on Apache+Firefox.
Then I wanted to add some transitions, like images fading in and out when clicking a button instead of just switching. So I:
1- downloaded react transition from here: https://github.com/reactjs/react-transition-group
2- added the content of its src folder to js, which now looks like this:
js/ ../<some vanilla.js files> ../libs/ ../libs/react.js ../libs/react-dom.js ../libs/browser.min.js ../libs/react-transition-group/ ......./react-transition-group/index.js ......./react-transition-group/CSSTransitionGroup.js ......./react-transition-group/CSSTransitionGroup.js ......./react-transition-group/TransitionGroup.js 3- loaded index.js like this:
Now, on Chrome, I get this error when I run the site:
index.js:1 Uncaught SyntaxError: Unexpected token import On Firefox:
SyntaxError: import declarations may only appear at top level of a module index.js:1 Any idea about what am I missing?
Thanks