Okay so I'm trying to intergrate React into an existing codebase. Currently we have a single page web-app that is operated by a common.js, however I have noticed that if JSX files or at least script files that are loaded as 'type="text/jsx"' in the HTMl file fail to appear within the scope of JS files. This creates a problem as we now have no way of manipulating the React components after initialization without refactoring an obscene amount of code. Common.js can't be transformed to JSX because we have external files/libraries that rely on it's scope.
1 Answer
You can "compile" your jsx files directly from the terminal. That way, you don't have to put type="text/jsx" because it will just be js code.
Here's an npm command line compiler called jsx
If you're using NodeJS for your server, you can use express-jsx middleware to compile your code on the fly.