fable-compiler / fable-react

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

How to create ReactElement from Browser.Types.Element #161

Closed cmeeren closed 5 years ago

cmeeren commented 5 years ago

Is it possible to create a ReactElement from Browser.Types.Element?

As an example usage, the Ref prop takes an Browser.Types.Element -> unit param, but AnchorEl from Fable.MaterialUI takes a ReactElement. I would like to set a ref and use it in AnchorEl, but that seems to require converting Browser.Types.Element to ReactElement, and I haven't found a way to do that.

alfonsogarciacaro commented 5 years ago

Not sure, is that possible in plain React?

cmeeren commented 5 years ago

I'm not sure. @mvsmal, could you clarify how AnchorEl is supposed to be used in Fable.MaterialUI? Do we need to convert a ReactElement to Browser.Types.Element, or have I misunderstood?

mvsmal commented 5 years ago

Hi @cmeeren. I've released version 4.1.0 of Fable.MaterialUI. There I changed the type of MaterialProp.AnchorEl. Please have a look at the docs: https://mvsmal.github.io/fable-material-ui/#/api/popper https://mvsmal.github.io/fable-material-ui/#/demos/popper

Feel free to raise an issue in fable-material-ui repository if you have any further questions.

cmeeren commented 5 years ago

Great, thanks!