# Introduction

> What miso is, the problems it solves, and where its ideas come from.

Source: https://haskell-miso.org/docs/introduction/

`miso` is a library for building web and native user interface applications. It provides a [React](https://react.dev)-like programming experience for a simple Haskell dialect that emphasises **performance**, **purity**, **simplicity**, **extensibility** and **composability**.

## What miso addresses

miso covers the common areas of web development so that you can spend your time on your application:

- **DOM manipulation** — miso uses a [Virtual DOM](https://en.wikipedia.org/wiki/Virtual_DOM) with a diffing algorithm that is responsible for all DOM modification and `Component` lifecycle hooks.
- **Event delegation** — all event listeners are attached to a top-level element (typically `<body>`). When raised, events are routed through the virtual DOM to Haskell handlers that change application state. Both the `capture` and `bubble` phases are virtualised.
- **Prerendering** — the server delivers HTML before the JavaScript or WebAssembly bootstraps. Instead of an initial draw, the client populates the virtual DOM from the real DOM ("hydration"), which avoids a redraw and helps SEO. `Miso.Html.Render` renders on the server; `miso` hydrates on the client.
- **Components** — a `Component` is a self-contained miso application bundling its state, the logic that updates it and a function that renders it. Components nest to arbitrary depth.
- **Custom renderers** — the underlying DOM operations are abstracted so a different rendering engine can be plugged in. This is how [miso targets mobile devices](https://haskell-miso.org/docs/native/overview/) through Lynx.
- **Lifecycle hooks** — `mount` and `unmount` on components, `onCreated` and `onDestroyed` on elements. Commonly used for component communication and third-party JavaScript integration.
- **State management** — component `model` state is manipulated with `Miso.Lens` or `Miso.State`.
- **HTTP / cookies** — `Miso.Fetch` wraps the Fetch API and `Miso.Cookie` the CookieStore API, each with an asynchronous callback-based `Effect` and a synchronous `_`-suffixed `IO` variant.

## Architecture

- **React** — miso implements a subset of the React architecture internals: components, lifecycle hooks, virtual DOM, event delegation, along with the Fragment, Props and Context API features.
- **Elm** — miso also implements the Elm architecture (model–view–update) and the `mailbox` communication pattern.

## Native (mobile)

Beyond the browser, miso targets native mobile devices by driving the [Lynx](https://lynxjs.org) runtime instead of the DOM. The same MVU model, `Component` API, event delegation and virtual-DOM diffing carry over unchanged — only the element vocabulary differs. The native backend is gated behind the `native` cabal flag; web and WASM builds are unaffected. See the [native section](https://haskell-miso.org/docs/native/overview/) for the dual-thread architecture.

## Where to next

- [Installation](https://haskell-miso.org/docs/installation/) — set up the WASM toolchain and build the sample app.
- [Your first Component](https://haskell-miso.org/docs/your-first-component/) — the counter, line by line.
- [Thinking in miso](https://haskell-miso.org/docs/thinking/overview/) — how to structure a real application.
