Home > database >  React - redirecting to full url and not relative url
React - redirecting to full url and not relative url

Time:03-15

Good afternoon,

I built a django form for my thesis work that I intend to interviewees. To make it more appealing and increase the number of answers (I hope! :)) I built a page using a tutorial on react. It looks very nice. The problem is that building my form with react looks like a nightmare.

So I would like to have a button on my react page that once clicked redirect to my django html page with the form. I looked online but none of the topics I found did the trick (React-Router External link, react-router redirect to a different domain url, react button onClick redirect page).

I would like to have something like:

<NavBtnLink to="http://127.0.0.1:8000/doctor/7f06cb1c-d68e-459e-9d07-ce4d52d2b50b/survey/">Take the survey</NavBtnLink>

but that tries to redirect me to:

http://localhost:3000/http://127.0.0.1:8000/doctor/7f06cb1c-d68e-459e-9d07-ce4d52d2b50b/survey/

instead of:

http://127.0.0.1:8000/doctor/7f06cb1c-d68e-459e-9d07-ce4d52d2b50b/survey/

Any idea of things I could try (on top of what is suggested in the mentionned topics?

CodePudding user response:

So in this case , you are not needing the power of react router .

Keep it simple and only use html a tag

 <a href="your link here">Take the survey</a>
  • Related