Comments (7)
I think Func
is the way to go, you could probably do some weird uncurrying with [<Emit(...)>]
but it could be tricky (I haven't tried it)
from feliz.
It most likely has to do with currying the handler
function, can you try this:
static member inline onChange(handler: Event -> bool -> unit) =
Interop.mkAttr "onChange" (fun (ev, capture) -> handler ev capture)
or if you tolerate tuples in the handler definition
static member inline onChange(handler: (Event * bool) -> unit) =
Interop.mkAttr "onChange" handler
from feliz.
Thanks! I tried both, and now the handler is called, but both params are undefined
, so I'm still lost. (They work fine if I remove the second parameter from the signature.)
from feliz.
Hmm that's weird, can you try using System.Func
?
static member inline onChange(handler: System.Func<Event, bool, unit>) =
Interop.mkAttr "onChange" handler
from feliz.
Yep, that works fine. But of course makes the signature more noisy.
Any idea what's going on?
Edit: This also works, so at least there's a user-invisible workaround:
static member inline onChange(handler: Event -> ReactElement -> unit) =
Interop.mkAttr "onChange" (System.Func<_,_,_> handler)
from feliz.
Any idea what's going on?
This is just how Fable compiles functions, using System.Func
tells Fable that we want the functions compiled the JS way (i.e. uncurried)
from feliz.
I see. So using Func
is the only way to make this work, or are there other syntaxes, too?
from feliz.
Related Issues (20)
- Cluttered imported React hook names HOT 1
- Filter: Blur doesn't work HOT 2
- Feliz.Template v4.3.0 doesn't contain any tests HOT 3
- Weird dispatch issue with useElmish HOT 5
- Elmish subscriptions does not work with Feliz.UseElmish
- Add jsx string template support to default template and to docs? HOT 1
- Feliz.Markdown plug-in support HOT 2
- Issue version 3.10.0 when using another Router component in the inner component
- IReactProperty Question HOT 1
- Q: interesting
- add vitest to template
- useElmish vs useReducer HOT 4
- Feedback on missing docs for newcomers HOT 1
- ReactComponentAttribute for props list HOT 2
- Q: Documentation on breaking changes in 2.6? [WAS Updating Feliz.UseListener to Feliz 2.6.0] HOT 4
- CSS overflow-anchor property HOT 1
- Error with Feliz 2.7 HOT 2
- Making UseElmish's dispatch function stable
- Feliz.Markdown escapeHtml doesn't seem to work HOT 1
- UseElmish: Failed to resolve import "use-sync-external-store/shim" HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from feliz.