Questions tagged [elmish]

Use for question relating to the elmish framework for f#. Consider also including the tags [fable-f#] and [f#].

Elmish is an implementation of the in and . It is modular in its design and can target different platforms and rendering libraries, but is typically used with , using elmish-react, and targeting web browsers, using elmish-browser.

Resources

65 questions
9
votes
1 answer

How can I do a simple elmish router?

Sorry, but I'm a newbie with Fable and F#. I started a boilerplate from SAFE project, and I created a SPA with two pages. However, all the logic is inside a single file. My question is. How can I implement a router putting each view in one file? I…
Pablo Darde
  • 5,844
  • 10
  • 37
  • 55
9
votes
1 answer

Does mkProgram expose more functionality than mkSimple?

I am trying to understand the difference between mkSimple and mkProgram in Fable-Elmish, or Elmish.WPF which I am actually using. (Can someone perhaps produce a tag for elmish.wpf please?) I have found Elmish.WPF to be incredibly effective, I use it…
Bent Tranberg
  • 3,445
  • 26
  • 35
8
votes
2 answers

How to handle redirects to auth provider from the backend in Fable Elmish SPA

I have an AspNetCore backend api (in F# with Giraffe) that uses AzureAD authentication with Microsoft.AspNetCore.Authentication.AzureAD.UI, with stateful session store, and https only cookies. The frontend is an Elmish SPA compiled to js with…
Balinth
  • 548
  • 4
  • 10
8
votes
4 answers

Convert React.FormEvent to BodyInit using Fable-Elmish

I am trying to upload a file using Fable-Elmish and the React Helpers. However, I can't work out how to convert the form event when a file is selected into something that I can send off to the server using Fetch. This is the view: R.input [ …
Dan O'Leary
  • 2,660
  • 6
  • 24
  • 50
5
votes
1 answer

How can I cancel Cmd.OfAsync as props change?

Suppose I have a controlled Elmish form: type Model = { Query : string IsLoading : bool Result : Result option } type Message = | UpdateQuery of string | ReceivedResults of Result
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
5
votes
1 answer

Using third party React Components with Fable/Elmish

I'm trying to integrate Carbon Design System - React SDK in a Fable/Elmish application and it looks like I have to create the property type definitions (some of them I just guessed) for every component in order to use it. The component already has…
A. Matías Quezada
  • 1,886
  • 17
  • 34
5
votes
3 answers

Return async value from Fable.Remoting

Here is a client side Fable.Remoting example that prints the result of an async function. // Client code (Compiled to Javascript using Fable) // ============ open Fable.Remoting.Client let server = Proxy.create async…
Brett Rowberry
  • 1,030
  • 8
  • 21
5
votes
2 answers

In fable-elmish, how to trigger a command after the view has been rendered?

I've created an app which downloads some data and plots it using Google Charts, to a div with a particular Id. This works fine on a static page. However, when using menus to switch between multiple views, I'm struggling to redraw the chart when…
Mark Pattison
  • 2,964
  • 1
  • 22
  • 42
5
votes
1 answer

Async Command in fable Elmish

I have this code I'm running using Fable Elmish and Fable remoting to connect to a Suave server. I know that the server works because of postman and there are variations of this code that does call the server let AuthUser model : Cmd = …
user1742179
  • 87
  • 1
  • 5
5
votes
1 answer

Elmish dispatch on Fable React stateful component

I need to use Fable-React stateful component with elmish dispatch. I can not figure out how to create it. I am using this project template: https://github.com/fable-elmish/templates here is model: module Home.Types [] type Model = { …
Jan Bizub
  • 193
  • 11
4
votes
2 answers

How to access Fable's promise results

Just starting out with Fable / Elmish / F#, but getting stuck getting a basic concept done... The goal of the code is to execute a simple HTTP GET request and, thereafter, to post the results of the GET request to the user on a web page. The idea…
Fred
  • 43
  • 3
4
votes
1 answer

Avoiding nesting boiler-plate in Elmish?

Suppose I have nested Elmish components like this: A contains B contains C. Then if C has state and messages, these must be passed from C to B and then to A. For example, the message and model types for B might be: type Message = | CMessage of…
sdgfsdh
  • 33,689
  • 26
  • 132
  • 245
4
votes
1 answer

Render component in Fable-Elmish

I have set up a standard SAFE application with the dotnet new SAFE command resulting in the two Server and Client projects (and the Shared folder). The Client project has the Client.fs file with the view function and the bootstrapping code, which is…
3
votes
0 answers

In Elmish/Elmish.WPF, This construct causes code to be less generic .... The type varable 'a has been constrained to be type 'Msg'

This statement in the update: let update m msg = match msg with | SetEncounterMsg encounter -> match encounter with | None -> init() , Cmd.none | Some s -> init () |> (fun q -> {q with Encounter = Some s}), …
Alan Wayne
  • 5,122
  • 10
  • 52
  • 95
3
votes
1 answer

How to enable a user to download a file in Fable?

I have a SAFE stack app. I need to enable users to upload and download files. Uploading works by making use of Browser.Dom.FileReader.Create() Is there a corresponding way to enable users to download files? This answer offers a solution using a…
Chechy Levas
  • 2,206
  • 1
  • 13
  • 28
1
2 3 4 5