Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Functional Principles in React (and Elm)

jessitron
August 24, 2015

Functional Principles in React (and Elm)

React and Flux embody some principles of functional programming. Understand these, and we can use them even more.

Given at React Rally, 24 August 2015

jessitron

August 24, 2015
Tweet

More Decks by jessitron

Other Decks in Programming

Transcript

  1. "Re C About asoning ode" Predicting what it will do

    in all situations not just this one I'm debugging or this one example test.
  2. update view init Model Action type alias Model = {

    recentEvents : List Event, highlight : Maybe EventActor }
  3. update view init Model Action init: Model init = {

    recentEvents = [], highlight = Nothing }
  4. update view init Model Action update action model = case

    action of SingleEvent event -> { model | recentEvents <- event : } PersonOfInterest actor -> { model | highlight <- Just actor }
  5. update view init view addr model = Html.div [ ]

    [ Header.view model.repo, RepoInput.view, EventTicker.view addr mode SeeThePeople.view addr mod ]