Is it possible to pass parameters from one route to another without going through the url in reactjs?

Asked

Viewed 817 times

-1

I’m learning reactjs and in the application I’m developing I have a login screen that authenticates the user to access a private route. On this private route I would like to load this user’s data into a header profile and then perform some operations on other screens with the user’s log. It is possible to pass some parameter to this private route without being of the type "route/:email" or "route/:idUsuario" ?

2 answers

0


You can use the Redux to save data on store the moment you change route (so that the data will be accessible on the other screens). Similarly, you can use the Connected-React-router, that already saves route data using Redux internally (so that if you pass data in the URL, you can access it on the other screen).

-2

Good afternoon Lury Felipe,

Dude, there are two methods of sending parameters:

GET AND POST

The method GET is passed by URL, example www.google.com/user=CiclanoDaSilva.

Already the POST is passed by a request body, being possible for example to send a JSON in the body.

I hope I helped you!!

  • Thanks for your help, Rodrigo, but I don’t think you understand my doubt. Maybe I expressed myself badly. My goal is to log in to authenticate and free access to a private route without this route being "https://domain/route/idUsuario", but simply "route/" not letting the user access the id of another person and the same is authenticated.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.