'If the user is logged in?

I'm new to react so my question may seem obvious.

What is the secure way of rendering certain things if the user is logged in?

Lets just say for example a person logs in so he sees a button to edit his bank details.

If I were to write a javascript script that executes showing the button if the person is logged in that seems like it could be hacked, by a hacker simply modifying the code to escape the check.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source