You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got adventurous and needed to create a Fable binding to the React Beautiful DnD library.
Then, I got stuck for a while, when trying to create a property for my React component, and my code didn't work.
I think here is that in React we want to use uncurry because of how we build the props information for React but if it was a not a React props current generation would be correct.
Unfortunately, I don't think this addressable for now in ts2fable
The answer is a bit complicated because the F# compiler treats module/type methods different from local functions, but you should be able to create the props with the generated declaration for example with an object expression:
However the syntax is not very beautiful, especially if you have to implement multiple props. That's way we often model the component props with a union type and use keyValueList to convert them to a JS obj. However, unfortunately ts2fable cannot make this kind of conversion automatically atm.
Hi :)
I got adventurous and needed to create a Fable binding to the React Beautiful DnD library.
Then, I got stuck for a while, when trying to create a property for my React component, and my code didn't work.
Generated F# code
Original TS definition
I realized that tuple arguments were passed as arrays, thanks to the generated JS code by the Feliz template project
Fixed via uncurrying
Thus, I fixed it the code by converting the prop to a curryfied property:
Why isn't that by default, if that's the way Fable generates JS function code?
Thanks :)
The text was updated successfully, but these errors were encountered: