+ );
+ }
+}
+
+export default GreetingTime;
diff --git a/src/PersonList.jsx b/src/PersonList.jsx
new file mode 100644
index 0000000..efa1fb6
--- /dev/null
+++ b/src/PersonList.jsx
@@ -0,0 +1,30 @@
+import React from "react";
+
+export class PersonList extends React.Component {
+ /**
+ * Renders a list of persons.
+ * @note Using array indices as keys is generally not recommended because:
+ * 1. It can cause performance issues when the list order changes (additions/removals)
+ * 2. It may lead to unexpected behavior or bugs with component state
+ * 3. React specifically warns against this practice in its documentation
+ * 4. If the list is re-ordered, indices will change, causing unnecessary re-renders
+ *
+ * Ideally, use a unique and stable identifier from each item as the key instead.
+ * Like here we could use person.name as the key.
+ */
+ render() {
+ const persons = [
+ { name: "John Doe" },
+ { name: "Georges Abitbol" },
+ { name: "Kevin McGregor" },
+ ];
+
+ return (
+
+ {persons.map((person, index) => (
+
{person.name}
+ ))}
+
+ );
+ }
+}
diff --git a/src/main.jsx b/src/main.jsx
index 080c501..f829b38 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -1,32 +1,52 @@
import { createRoot } from "react-dom/client";
-const user = {
- id: 1,
- name: "John Doe",
-};
+import Button from "./Button";
+import CustomButton from "./CustomButton";
+import Greeting from "./Greeting";
+import GreetingImage from "./GreetingImage";
+import GreetingTime from "./GreetingTime";
+import { PersonList } from "./PersonList";
-function capitalize(name) {
- return name.toUpperCase();
+function handleClick() {
+ alert("Congratulation! You clicked a button!");
}
-function getAvatarUrl(user) {
- return `https://api.dicebear.com/9.x/adventurer/svg?seed=${user.name}${user.id}`;
-}
-
-const greeting = (
+const greetings = (