Skip to content

Instantly share code, notes, and snippets.

@sadhakbj
Last active May 5, 2021 05:28
Show Gist options
  • Select an option

  • Save sadhakbj/746ca7cde2760f7a2082a7931c5f55a5 to your computer and use it in GitHub Desktop.

Select an option

Save sadhakbj/746ca7cde2760f7a2082a7931c5f55a5 to your computer and use it in GitHub Desktop.
App.tsx
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