-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ideas for Samples #13
Comments
... I'd like to implement a global persistent record. It reads json from localstorage on startup and encode and save the record to storage on every update. Here is how it's done in svelte: PS: The repl is sandboxed so it won't work there. |
Hi, thank you for the project! I'm giving it a try and it's not a clear how to use global state. This is what I've tried, but it doesn't work let globalCount<'a> = ofMutable {0}
let counter =
vide {
div {
let! count = ofMutable {0}
let! gv = globalCount
button.onclick(fun _ ->
count.Value <- count.Value + 1
gv.Value <- gv.Value + 1
) {
$"Count"
}
$"Value={count.Value} Global={gv.Value}"
}
}
let view =
vide {
do! counter
do! counter
} UPD: I've managed to make global state using standard F# DI approach https://gist.github.com/Lanayx/7b9426cbb11ed7a2ffa29c83e6653a24 |
https://twitter.com/1kap10/status/1729494967205105781
Nice project, would like to see examples with global state management, listening to window events and json handling.
How do rendering work?
Vdom/Signals/Rerender everything or something else?
The text was updated successfully, but these errors were encountered: