Apply for Zend Framework Certification Training

ReactJs





Update in reactJs

Step 1 Add some or the  code in userlist.jsx

    import { useNavigate } from 'react-router-dom'

    const navigate = useNavigate();

    const handleEdit=(id)=>{

            navigate('/edit/'+id)

        }

    <input type='button' value="Edit" class="actionbutton" onClick={()=>{handleEdit(User.users_id)}}/>

Step -2 Add some of the code in App.js

     <Route path='/edit/:id' element={<Editpage/>}/>

Step-3 Add some of the code in registration.jsx

    useEffect(()=>{

            if(location.pathname.split('/')[1] == 'edit'){

                   getform_name('Update form')

                getbutton_name('Update')

            }

        },[])

Step-4    Chnage a condition in registration form 

      {button_name !='Login' && ......

    }


 

Step 1 Add some code in registration.jsx

    import { useLocation, useParams } from 'react-router-dom'

    const params = useParams() 

    if(location.pathname.split('/')[1] == 'edit'){

            console.log(params.id)

            axios.get('https://api.uncodecart.com/users/singleuserlist/'+params.id).then((response)=>{

                getfirstname(response.data.message[0].firstname)

                getlastname(response.data.message[0].lastname)

                getmobileno(response.data.message[0].mobileno)

                getemail(response.data.message[0].email)

                getpassword(response.data.message[0].password)

            });

            getform_name('Update form')

            getbutton_name('Update')

        }

 

< First Getting Started With CodeIgniter URL Routing >



Ask a question



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


Back to Top