Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support for Preact #40

Open
derekbking opened this issue Nov 23, 2022 · 1 comment
Open

Support for Preact #40

derekbking opened this issue Nov 23, 2022 · 1 comment

Comments

@derekbking
Copy link

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.

@pimterry
Copy link
Member

No idea I'm afraid. I've never really used Preact beyond basic messing around, and I'm not sure how the relevant internals differ.

If there are changes required, PRs are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants