Apply for Zend Framework Certification Training

ReactJs



< create an home page or landing page in reactJs Last >



Step -1 Add a code in registration.jsx
axios.post('https://api.uncodecart.com/users/login',formData).then((response)=>{
                if(response.data.message == 'Either password or email is wrong'){
                   .....
                }else{
                    localStorage.setItem('firstname',response.data.message[0].firstname)
                    navigate('/userlist')
                }
            }) 
 
 
Step -2 Add a code in header.jsx
 var firstname = localStorage.getItem('firstname')
    const handlelogout = ()=>{
        localStorage.clear()
        navigate('/login')
    }
 
Step-3 Add a code in header.jsx to 
 
       <ul class="nav-links">
              .......
                {firstname != null &&
                <>
                    <li><a onClick={()=>{navigate('/userlist')}}>User list</a></li>
                    <li><a onClick={handlelogout}>{firstname}(Logout)</a></li>
                </>
                }
               .......
            </ul>

< create an home page or landing page in reactJs Last >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top