Search code examples
htmlreactjshref

Opening a React App through a HTML file's <a href> link


I have a HTML file with a list of links. Some of the links lead to other HTML files, but I want one to lead to a react application. I have not been able to open the app like I would a normal HTML though. Not through public/index.html or src/App.js.

How do I open a React application through a simple link?

Here is an example of the link list in the current HTML:

<a href="snake/game.html">Snake</a>
<a href="snake/game.html">Snake</a>
<a href="myApp/src/App.js">React App</a> <!--problem on this line-->

Solution

  • Write the link of server of react that you have started using npm start . It's http://localhost:5000 by default. So write

    <a href="http://localhost:5000">React App</a> <!--problem solved-->
    

    But make sure you have started react app on server by npm start