John Arellano John Arellano - 15 days ago 6
React JSX Question

Run build app with React and Gulp

I am following the tutorial for React in Lynda.com.
But I can't see the preview in the browser.

Here is the link of the Repo for the files.
https://github.com/planetoftheweb/reactinterface/tree/02_01b

How can I view this in my browser with localhost:8080?
My browser just display the directories.
I am using XAMPP in windows 8.1. Do I need to install something? or configure something?
When I tried viewing localhost/builds/app/index.html,
it is showing but the react is not processed.

Answer

You don't need any special web server, like XAMPP, because a browser can interpret your js code itself. You just need to include your compiled js file into your index.

Maybe you will need to add React sources, if you don't use any bundle framework like Webpack or Browserify.

<script src="https://unpkg.com/react@15/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script>

Also, I would recommend read the official tutorial here.

Comments