          }
            const jsonData = await response.json();
            state.data = jsonData;
          } catch (error) {
            console.error("Fetch error:", error);
            state.data = null;
            state.error = error.message;
          } finally {
            state.isLoading = false;
            render();
          }
        }

        // --- Event Handlers & Initialization ---

        /**
         * Handles the form submission to trigger a data fetch.
         * @param {Event} event