Skip to content

Instantly share code, notes, and snippets.

{-
Equivalent Miso pattern for the following React pattern:
```tsx
import React from 'react'
const Counter = () => {
const [counterState, setCounterState] = React.useState(0)
const onPlusClicked = () => setCounterState((prev) => prev + 1)
return (
@mtamc
mtamc / Persistence.hs
Last active April 17, 2026 17:46
Miso automatic localstorage model persistence with debounce
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
module Miso.Persistence (
Trigger' (..),
PersistenceDebouncer (..),
PersistenceHandle (..),
findPersistedModel,