0

I have two urls in my project. the first one: http://localhost:3000/?/#chain=Matic, and the other one: http://localhost:3000/?/#chain=Bsc. I want the function I created to run when entered with this url. How can I do that?

For example, when this http://localhost:3000/?/#chain=Matic address is entered, I want the relevant function to be loaded automatically after the page is loaded. Is there a way to do this?

TylerH
  • 20,799
  • 66
  • 75
  • 101
soner
  • 1
  • 2

1 Answers1

0

You'd want to amend the URL so that we're pulling from the get parameters. Then we can look for the variable when the page first loads and run logic depending on what the value is:

Here's a complete example: https://codesandbox.io/s/resolve-url-parameter-2odpc

  • Please do not post link only examples. Include the code in the answer. – evolutionxbox Feb 12 '22 at 12:09
  • Thank you so much for your help. I'm trying this method right now. i will get back to you as soon as possible – soner Feb 12 '22 at 15:31
  • 1
    It was really a problem that I couldn't find a solution for for weeks. I have solved it because of you. Thank you very much. really. – soner Feb 13 '22 at 07:32