diff --git a/react-frontend/src/components/HobbyList.js b/react-frontend/src/components/HobbyList.js
new file mode 100644
index 000000000..0bdba4f3d
--- /dev/null
+++ b/react-frontend/src/components/HobbyList.js
@@ -0,0 +1,37 @@
+javascript
+import React, { useEffect, useState } from 'react';
+import { fetchHobbies } from '../api/hobbyApi'; // Assuming there's a fetch function
+
+const HobbyList = () => {
+ const [hobbies, setHobbies] = useState([]);
+ const [isLoading, setLoading] = useState(true);
+ const [error, setError] = useState(null);
+
+ useEffect(() => {
+ const loadHobbies = async () => {
+ try {
+ const data = await fetchHobbies();
+ setHobbies(data);
+ } catch (err) {
+ setError(err.message);
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ loadHobbies();
+ }, []);
+
+ if (isLoading) return
Loading...
;
+ if (error) return Error: {error}
;
+
+ return (
+
+ {hobbies.map((hobby) => (
+ - {hobby.name}
+ ))}
+
+ );
+};
+
+export default HobbyList;
\ No newline at end of file
diff --git a/spring-backend/src/main/java/com/example/hobby/Hobby.java b/spring-backend/src/main/java/com/example/hobby/Hobby.java
new file mode 100644
index 000000000..ac289d272
--- /dev/null
+++ b/spring-backend/src/main/java/com/example/hobby/Hobby.java
@@ -0,0 +1,20 @@
+java
+package com.example.hobby;
+
+public class Hobby {
+ private int id;
+ private String name;
+
+ public Hobby(int id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
\ No newline at end of file
diff --git a/spring-backend/src/main/java/com/example/hobby/HobbyController.java b/spring-backend/src/main/java/com/example/hobby/HobbyController.java
new file mode 100644
index 000000000..f7bd3ebf9
--- /dev/null
+++ b/spring-backend/src/main/java/com/example/hobby/HobbyController.java
@@ -0,0 +1,19 @@
+java
+package com.example.hobby;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+import java.util.List;
+
+@RestController
+public class HobbyController {
+
+ @Autowired
+ private HobbyService hobbyService;
+
+ @GetMapping("/api/hobbies")
+ public List getAllHobbies() {
+ return hobbyService.getAllHobbies();
+ }
+}
\ No newline at end of file
diff --git a/spring-backend/src/main/java/com/example/hobby/HobbyService.java b/spring-backend/src/main/java/com/example/hobby/HobbyService.java
new file mode 100644
index 000000000..38df1291b
--- /dev/null
+++ b/spring-backend/src/main/java/com/example/hobby/HobbyService.java
@@ -0,0 +1,19 @@
+java
+package com.example.hobby;
+
+import org.springframework.stereotype.Service;
+import java.util.List;
+
+@Service
+public class HobbyService {
+
+ // Assuming a repository or direct data source is available
+ public List getAllHobbies() {
+ // Retrieve data from data source, e.g., database or static list
+ return List.of(
+ new Hobby(1, "Painting"),
+ new Hobby(2, "Drawing"),
+ new Hobby(3, "Sculpting")
+ );
+ }
+}
\ No newline at end of file