// view.js // Pure view functions /** * Pure view functions for the application. * * Why pure functions returning HTML strings? * - Keeps rendering logic stateless and easy to test. * - Ensures the UI is always a direct function of state, avoiding UI bugs from incremental DOM updates. * - Using template literals is minimal and browser-native, with no dependencies. * * Why escape output? * - Prevents XSS and ensures all user/content data is safely rendered. * * Why semantic/accessible HTML? * - Ensures the app is usable for all users, including those using assistive tech, and is easy to reason about. */ /** * Render the app UI as an HTML string * @param {object} state * @returns {string} */ export function view(state) { return `