On-demand login with Keycloak and ReCTJS

Right now i am securing URL with Keycloak and reactJS …Can someone please help me to give one demo example how we can use Keycloak with reactjs for ondemand login . Like Button will visible but operation will be possible only user already login if not user will be redirect to login page first then he can submit the form .