Last active
June 14, 2019 11:39
-
-
Save Mayankgupta688/0723be494125bf0c596a32b54472c61e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from "react"; | |
| export default function EmployeeDetails() { | |
| const [name] = useState("Mayank"); | |
| const [age, setAge] = useState(31); | |
| const [designation] = useState("Senior Developer"); | |
| function updateEmployeeAge() { | |
| setAge(age + 1); | |
| } | |
| return ( | |
| <div> | |
| <p>Employee Name: {name}</p> | |
| <p>Employee Age: {age}</p> | |
| <p>Employee Designation: {designation}</p> | |
| <input type="button" onClick={updateEmployeeAge} value="Click To Update Age" /> | |
| </div> | |
| ) | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment