Skip to content

Instantly share code, notes, and snippets.

@Mayankgupta688
Last active June 14, 2019 11:39
Show Gist options
  • Select an option

  • Save Mayankgupta688/0723be494125bf0c596a32b54472c61e to your computer and use it in GitHub Desktop.

Select an option

Save Mayankgupta688/0723be494125bf0c596a32b54472c61e to your computer and use it in GitHub Desktop.
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