0

So I've been working on a react website whose file system is like this:

  • public:
    • index.html
    • second.html
  • src:
    • index.js
    • second.js
    • table.js
    • forms.js

So I have a form and a table in the main page (index.js). One of the columns in the table contains the link to access the second page. And the second.html should be linked with second.js. I tried using

<script src="second.js></script>

on the HTML page but it didn't work. I even tried ../src/second.js in the script tag. Can anyone point out what is the problem here and what can be done about it?

Thank you

Kaushik N
  • 11
  • 1
  • 1
    i really wanted to help unblock you but i couldn't understand what you meant. I think you should edit the question and make it more understandable. #cheers – Monday A Victor Jul 22 '20 at 23:00
  • Could you expose some code to show us how you handled it? You are talking about routes, so please improve your question. – felipekm Jul 22 '20 at 23:03

1 Answers1

0

I'm not sure if it's possible to use a second HTML page within react (dont take my word for it, i'm not sure), but if you are trying to create multiple pages you need to look at react-router. Here is a link to help you out. How to create multiple page app using react .

justanotherguy
  • 395
  • 4
  • 17