fable-compiler / fable-react

Fable bindings and helpers for React and React Native
MIT License
275 stars 66 forks source link

Using from + pojo #28

Closed jgrund closed 6 years ago

jgrund commented 7 years ago

Is there an example with using

https://github.com/fable-compiler/fable-react/blob/next/fable-react/Fable.Helpers.React.fs#L588

to create an Element? I'm trying to upgrade the react native demo project to 1.0, and seem to be hitting issues here when transpiling.

alfonsogarciacaro commented 7 years ago

Hi @jgrund! Actually the fable-electron Material UI is probably the best example at the moment. There dynamic objects are used, which are compatible with Pojo: https://github.com/fable-compiler/fable-electron/blob/master/samples/material-ui/src/Renderer/Renderer.fs#L51-L54

It's important to declare the imported object as a React.ComponentClass: https://github.com/fable-compiler/fable-electron/blob/737baef8a47abe4f82f8ce25691fb53b6484364e/samples/material-ui/src/Renderer/Renderer.fs#L10-L20