Zaid-Ajaj / Feliz

A fresh retake of the React API in Fable and a collection of high-quality components to build React applications in F#, optimized for happiness
https://zaid-ajaj.github.io/Feliz/
MIT License
534 stars 78 forks source link

Trying to create a IReactProperty in FSI crashes #553

Closed EverybodyKurts closed 1 year ago

EverybodyKurts commented 1 year ago

I have an fsx script that crashes whenever I send it to FSI. The contents are the following:

#r "nuget: Feliz"

open Feliz

let property1: IReactProperty = prop.className "foo"

It results in the following error:

System.InvalidCastException: Unable to cast object of type 'System.Tuple`2[System.String,System.Object]' to type 'Feliz.IReactProperty'.

I'm using F# 7.0 and Feliz 2.4.0

Zaid-Ajaj commented 1 year ago

Hi @EverybodyKurts Feliz is a library which only works in F# projects that are compiled to JavaScript using Fable. FSI sessions don't know to compile the code to JS so this behaviour is expected. If you are looking for a view engine to render HTML that works on both on client and server, then I suggest using Feliz.ViewEngine but there are others as well 😄