This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing (main) | |
import Html.App | |
import Html exposing (Html, div, ul, li, form, input, button, strong, text) | |
import Html.Events exposing (onSubmit, onInput) | |
import Html.Attributes exposing (type', value) | |
import Dict exposing (Dict) | |
-- MODEL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Attribute<Msg> | |
= VEvent<Msg> | |
; | |
type Decoder<Msg> = (event: Event) => Msg; | |
interface VEvent<Msg> { | |
type: 'V_EVENT'; | |
key: string; | |
value: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* @flow */ | |
const curryResolver = (fn, arity, mem) => (...args) => { | |
const resultArgs = args.concat(mem); | |
return resultArgs.length >= arity | |
? fn(...resultArgs) | |
: curryResolver(fn, arity, resultArgs) | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type FrontendMsg | |
= FNoop | |
| Increment | |
| Decrement | |
| OnBackendMsg ToFrontend | |
update : FrontendMsg -> Model -> ( Model, Cmd FrontendMsg ) | |
update msg model = | |
case msg of | |
FNoop -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-console */ | |
import { | |
Dispatch, | |
SetStateAction, | |
useRef, | |
useReducer, | |
useEffect, | |
useCallback | |
} from 'react' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/ohansemmanuel/polymorphic-react-component | |
import React from "react"; | |
type PolymorphicRef<TComponent extends React.ElementType> = React.ComponentPropsWithRef<TComponent>["ref"]; | |
type AsProp<TComponent extends React.ElementType> = { | |
as?: TComponent; | |
}; |