Skip to content

Support for Preact #40

Open
Open
@derekbking

Description

@derekbking

I have been using this library with React and it has been extremely helpful and I haven't encountered any problems with it. Recently I started working on a project in Preact and I can't seem to get the portals to work properly.

I am getting the following errors:

src/app.tsx:23:11 - error TS2607: JSX element class does not support attributes because it does not have a 'props' property.

23           <portals.OutPortal node={portalNode}></portals.OutPortal>
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/app.tsx:23:12 - error TS2786: 'portals.OutPortal' cannot be used as a JSX component.
  Its instance type 'OutPortal<unknown>' is not a valid JSX element.
    Type 'OutPortal<unknown>' is missing the following properties from type 'Component<any, any>': state, props, context, setState, forceUpdate

23           <portals.OutPortal node={portalNode}></portals.OutPortal>
              ~~~~~~~~~~~~~~~~~

src/ThruModal.tsx:49:7 - error TS2607: JSX element class does not support attributes because it does not have a 'props' property.

49       <portals.InPortal node={portalNode}>
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/ThruModal.tsx:49:8 - error TS2786: 'portals.InPortal' cannot be used as a JSX component.
  Its instance type 'InPortal' is not a valid JSX element.
    Type 'InPortal' is missing the following properties from type 'Component<any, any>': state, props, context, setState, forceUpdate

49       <portals.InPortal node={portalNode}>
          ~~~~~~~~~~~~~~~~

Is this library compatible with Preact? I should mention I am using Vite / rollup to create my builds where in the past when using React I used react-scripts / web-pack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions