ohanhi / elm-native-ui

[CLOSED] Experiment: mobile apps in Elm using React Native.
BSD 3-Clause "New" or "Revised" License
1.54k stars 75 forks source link

Provide a StartApp-esque API #18

Closed ohanhi closed 8 years ago

ohanhi commented 8 years ago

Elm developers are familiar with the StartApp pattern, so Elm Native UI should have a similar API.

From evancz/start-app:

main =
  StartApp.start { model = model, view = view, update = update }

model = 0

view address model =
  div []
    [ button [ onClick address Decrement ] [ text "-" ]
    , div [] [ text (toString model) ]
    , button [ onClick address Increment ] [ text "+" ]
    ]

type Action = Increment | Decrement

update action model =
  case action of
    Increment -> model + 1
    Decrement -> model - 1