fable-compiler / fable-react

Fable bindings and helpers for React and React Native
MIT License
273 stars 67 forks source link

What are the Fable.React 5 replacements for these types? #155

Closed cmeeren closed 5 years ago

cmeeren commented 5 years ago

The following types seem to have been removed in Fable.React 5. What should be used now?

MangelMaxime commented 5 years ago

Quoting Announcing fable-compiler 2.2, Fable.Core 3 and more :)

The React event interfaces have been replaced with Browser.Types. Except for SyntheticEvent and FormEvent (which are just assimilated to Event), the other events have corresponding ones with same name.

I don't know for CSSProperties

cmeeren commented 5 years ago

Thanks, but FormEvent doesn't seem to exist in the Browser.Types namespace (or even at all in this repo - for the record, neither does CSSProperties).

MangelMaxime commented 5 years ago

If I understand correctly the quotes SyntheticEvent and FormEvent are now Event.

cmeeren commented 5 years ago

Oh, sorry, I really need to learn how to read. 😳 Thanks!

Just CSSproperties left, then.

alfonsogarciacaro commented 5 years ago

Because Fable.React uses union types to represent React props, ideally you should use something like Style to accept a CSSProp list.

If you need to get a handle of the CSSProperties object, you could use something like this:

type CSSProperties =
    interface end

let inline cssProps (css: CSSProp list): CSSProperties =
    keyValueList CaseRules.LowerFirst css :?> _

We're trying to make all helpers in Fable.React compatible with SSR. So it's a bit tricky to add such a function directly to this library.

cmeeren commented 5 years ago

Thanks! I'll defer the API decision in this particular context to the maintainer of Fable.MaterialUI, since I haven't been able to figure out how the props using CSSProperties are intended to be used.