Splitting into independent MVU states
Learn how to break down a big app into several smaller programs with View.map
type Model =
{ CurrentPage: int
FirstName: string
LastName: string
EmailAddress: string
Password: string
ConfirmPassword: string
... }
type Msg =
| FirstNameChanged of string
| LastNameChanged of string
| EmailAddressChanged of string
| PasswordChanged of string
| ConfirmPasswordChanged of string
| ...
let update msg model =
match msg with
| FirstNameChanged newValue -> { model with FirstName = newValue }
| ...
let view model =
NavigationPage() {
ContentPage("Form1", ...)
if model.CurrentPage >= 2 then
ContentPage("Form2", ...)
if model.CurrentPage >= 3 then
ContentPage("Form3", ...)
...
}
let program = Program.stateful init update viewDecomposing a big app with View.map
Calling init at the right time
Calling update at the right time
Final result
Last updated