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
3
votes
1 answer

HMR - Update failed: SyntaxError: Unexpected token < in JSON at position 0

I'm working in a Elmish application. I put in place SSR (server-side rendering) for the index page only as I need some dynamically generated initial state at the start of the application. Since the Hot module replacement is not working and it is…
sabotero
  • 4,265
  • 3
  • 28
  • 43
3
votes
1 answer

Syntax confusion in Fable with EventTarget

I'm new to Fable/Elmish/React, and I'm trying to understand the syntax to cast an EventTarget so I can get to the .value The examples I can find all use the input [ Value model.Value OnChange (fun ev -> ev.target?value |> string …
Paul Lawrence
  • 197
  • 3
  • 14
3
votes
1 answer

Handling custom events in Fable-Elmish

Hot on the heels of my previous question the example I am working on in "Elm in Action" (and trying to port to Fable-Elmish) has a custom event from a custom element. In the html file I have the following:
melston
  • 2,198
  • 22
  • 39
3
votes
0 answers

Attributes vs Properties in Fable Elmish

I am going through the book "Elm in Action" and trying to convert the application developed there to Fable-Elmish. Many things translate directly from Elm to Elmish but not everything (at least not directly). Right now I am trying to understand…
melston
  • 2,198
  • 22
  • 39
3
votes
1 answer

Resolving .net namespace conflicts

I'm using Giraffe and trying to integrate Elmish.Bridge. I get the following error: error FS0892: This declaration opens the module 'Elmish.Bridge.Giraffe', which is marked as 'RequireQualifiedAccess'. Adjust your code to use qualified references to…
sashang
  • 11,704
  • 6
  • 44
  • 58
3
votes
1 answer

How do I set a default Value in a dropdown menu in Fable Elmish?

i want to have a default value in the dropdown that isnt one of the choosable options (not: DefaultValue "2"). It should be something like the following but not for an input-field. Input.Placeholder "Your name here" ( i tried Placeholder in…
Einhorni
  • 79
  • 5
3
votes
1 answer

How to add img tag using Fable-Elmish

I want to add an image tag like so img [ Src "/AirPassengerData.png" ] but the image does not load when I view the generated website. I am using the dotnet core project template fable-elmish-react and although I have found this…
user7817808
  • 111
  • 2
  • 8
3
votes
1 answer

How to setup fable-elmish-react native app?

I'm able to setup Elmish-React by following https://github.com/fable-elmish/react dotnet new -i "Fable.Template.Elmish.React::*" dotnet new fable-elmish-react -n MyProject but I can't figure out what I need to do to get the equivalent native app. I…
Stephen Straton
  • 709
  • 5
  • 12
2
votes
1 answer

Login in a multi-page website (SAFE Stack)

Does anybody use the Elmish routing for a multi-page app (SAFE Stack in my case) as specified by Maxime Mangel here on StackOverflow , but with a login page? Do you, at the same time, use the accessibility (Anonymous/LoggedIn) philosophy as…
2
votes
0 answers

How to measure the width of a string using Fable or Feliz in an Elmish app?

In an Elmish app (using Fable and Feliz), I'm trying to create a container (a div) with the exact width as an arbitrary string. Is there a way to measure the width of a string ahead of time (before displaying it)?
redcurry
  • 2,381
  • 2
  • 24
  • 38
2
votes
1 answer

How To Read A Dropped File F#

I have a Elmish-React project and this dropzone OnDrop (fun e -> let file = e.dataTransfer.files.item 0 e.preventDefault() e.stopPropagation() ) how do I load the content of this file?
fourglobe
  • 31
  • 6
2
votes
1 answer

passing/converting Elmish `dispatch` messages from a parent component to a child component

In the wonderful FBlazorShop repo, Onur Gumus is riffing off of Steve Sanderson’s Pizza Workshop with F# flavor. On line 128 of blob/master/FBlazorShop.Web.BlazorClient/Home/Home.fs [GitHub], Onur is passing an Elmish Message for the parent,…
rasx
  • 5,288
  • 2
  • 45
  • 60
2
votes
2 answers

How is child/submodel to parent/main model messaging done in Elmish.WPF?

(Newbie question). In Elmish.WPF, I have a parent module, App, holding a child submodule, FinderLastName: module App = type Model = { FinderLastName: FinderLastName.Model } type Msg = |…
Alan Wayne
  • 5,122
  • 10
  • 52
  • 95
2
votes
1 answer

Javascript onclick alternative in F# - SAFE

I have two divs of matching sizes on a page, and want to hide one and display the other, swapping between them on a button click. Usually i would use a javascript click event to toggle display, but i am unsure of how to use default Javascript with…
David McIntyre
  • 218
  • 1
  • 9
2
votes
2 answers

How do I solve encoder problem with the Elmish Debugger?

I've got an application that I've built in SAFE-Stack using websockets, more or less following the approach here: https://github.com/CompositionalIT/safe-sockets It works fine but the Elmish debugger doesn't like the type of WsSender in this…