Created
August 17, 2020 07:10
-
-
Save jonasdw/5d4a121e82870954b9602813262a54fe to your computer and use it in GitHub Desktop.
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 State = { | |
Domains: Domain list | |
Counter: int | |
} | |
// Imagine having a function somewhere dat increments our counter automatically (or manual whatever floats your boat) | |
let view .... = | |
div [] [ | |
counter state.Counter | |
SomeComponent.render {| Domains = state.Domains |> List.filter (fun d -> d.Selected } |} | |
] | |
// Every time the counter gets incremented the state changes. | |
// View fn picks up that state change and filters the domains again (which havent been changed) | |
// That results in a new list and our function component gets rerendered. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment