An Elm Primer for React Developers
/
Part III: Building Real Applications
Part III: Building Real Applications
https://leanpub.com/elm-for-react-devs
Up next
Chapter 9: Organizing Files and Modules
In this part
Chapter 9: Organizing Files and Modules
Moving Beyond the Single-File Approach?
Elm is Different
Let’s Build an Advent Calendar App
Basic Advent Calendar Spec
Starting Simple: The Mock Date Version
Getting the Real Date: Enter Tasks
When to Split: Modules for Data Structures
The Freedom of Safe Refactoring
What We’ve Learned
Chapter 10: Modules Around Data Structures
Opaque Types: Hiding What Shouldn’t Be Seen
Going Further: Phantom Types
The Complete Calendar Module
Using the Calendar Module
What We Gained
The Broader Pattern: State Machines in Types
When to Use Each Pattern
The Freedom to Reorganize
What We’ve Learned
Chapter 11: Forms and Validation
A Simple Contact Form
When Validation Enters the Picture
Finding the Right Abstraction
What We Learned
Chapter 12: Building a Feedback Wizard
The Problem: A Feedback Widget
Modeling the Top-Level State
The OutMsg Pattern
Why OutMsg Works
Native Dialogs and Ports
The Complete Main Module
The Api Module
Patterns Worth Noting
What We Learned
Chapter 13: Routing and Navigation
From Element to Application
Modeling Routes as Types
Parsing URLs
Building URLs
The Application Structure
Handling Navigation
A Page Module
Comparing to React Router
The Complete Example
Wrapping up
Chapter 14: State Patterns at Scale
From Booleans to State Machines
Reversible State Machines
A Second State Machine: Form Lifecycle
From Type to Module
Composing Models
Shared State
The Underlying Principle
Wrapping Up
Chapter 15: Testing Strategies
From Jest to elm-test
TDD Where It Shines
Fuzz Testing: Let the Framework Think
What You Don’t Need to Test
The Complete Code
Wrapping Up
Chapter 16: The Elm Ecosystem for React Developers
The Part Where npm Lies to You (And Elm Doesn’t)
Popular Packages and Community Patterns
When the Ecosystem Doesn’t Have What You Need
Wrapping Up