Reactjs build difference


#1

Hi Guys,

I am fairly new to reactjs and Javascript.
I am just trying to learn reactjs. I have a bunch of doubts when I started learning reactjs few of them I manage to clear reading stuffs online. Some of the answers for my questions are hard to find. Please bear with me if my question sounds silly.

The reactjs local server for development serves file for front-end in a localhost:port … Is this the same way a production server also works?
Is it safe to put my program logic in the front-end page then?

for instance if my login page run a fetch to a specific IP and then a promise try to change the my state object isLogged : false to islogged : true
cant this be manipulated at the front end to access a protected route?

I am trying to find answers for these general question.
regards,
Riyesh


#2

Production servers and localhost can be very different, so unless all you are doing is serving static pages, there is no guarantee they will both be similar. The safest approach is to test by uploading your react content to your server and working against the environment there.

Regarding your login scenario, yes - someone can easily change the value of isLogged on the client itself using any browser Developer Tools. You generally want to keep all of that logic on the server itself :slight_smile: