Last active
May 5, 2021 05:28
-
-
Save sadhakbj/746ca7cde2760f7a2082a7931c5f55a5 to your computer and use it in GitHub Desktop.
App.tsx
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 interface IUser { | |
| name: string; | |
| age: number; | |
| } | |
| const App = () => { | |
| const [users, setUsers] = useState<IUser[]>([ | |
| { | |
| name: "Bijaya", | |
| age: 25, | |
| }, | |
| { | |
| name: "Ram", | |
| age: 25, | |
| }, | |
| ]); | |
| return ( | |
| <div> | |
| <h1>Users list</h1> | |
| <ul> | |
| {users.map((user: IUser) => { | |
| return ( | |
| <li> | |
| {user.name} is {user.age} years old | |
| </li> | |
| ); | |
| })} | |
| </ul> | |
| </div> | |
| ); | |
| }; | |
| export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment