Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Import React Components #306

Open
0x53A opened this issue Jun 29, 2019 · 1 comment
Open

Import React Components #306

0x53A opened this issue Jun 29, 2019 · 1 comment

Comments

@0x53A
Copy link
Contributor

0x53A commented Jun 29, 2019

Currently react components are not really correctly imported.

Looking a bit through github I found fable-compiler/fable-react#151 (comment)

For example, react-popper-tooltip currently generates this

    type [<AllowNullLiteral>] IExports =
        abstract Tooltip: TooltipStatic

    type [<AllowNullLiteral>] Tooltip =
        inherit Component<TooltipProps>
        abstract componentDidMount: unit -> unit
        abstract componentDidUpdate: unit -> unit
        abstract componentWillUnmount: unit -> unit
        abstract render: unit -> JSX.Element

    type [<AllowNullLiteral>] TooltipStatic =
        [<Emit "new $0($1...)">] abstract Create: unit -> Tooltip
        abstract contextType: React.Context<TypeLiteral_01> with get, set

Better would probably be:

    type [<AllowNullLiteral>] IExports =
        abstract Tooltip: ReactElementType<TooltipProps>

Edit:

Hm, I don't think I can (easily) create an instance from an ReactElementType in F#, so maybe better generate this:

    type [<AllowNullLiteral>] IExports =
        abstract Tooltip: TooltipProps -> ReactElement
@0x53A
Copy link
Contributor Author

0x53A commented Jul 1, 2019

SyntheticEvent was removed from Fable.React, in most cases MouseEvent should be used.

robsiera pushed a commit to HolonCom/semantic-ui-react-fable-experiment that referenced this issue Dec 22, 2019
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant