DarkProdigy's avatar

Getting value from laravel backend to separate react frontend on redirect

I have redirect in my laravel backend to a separate react front end. I am using the with() function to pass the data but I am not sure how to get this data in my front end project without making an api call to my backend.

0 likes
1 reply
Nakov's avatar

when you use with that data is stored in the session so you cannot access it directly from your front-end react app. At least you should not be able to access it directly, because the front-end will expose your connection credentials and so on..

So if what you want to return is not secret of some sort, then you can return it back in the URL as query parameters and access them like that from your react component. But of course the best way to go for this will be an API call in my opinion. Again it depends what you need to do.

Please or to participate in this conversation.