NodeJS Supabase Auth组件的Qwik useState错误

tzxcd3kk  于 2023-06-05  发布在  Node.js
关注(0)|答案(1)|浏览(93)

我知道这里没有太多关于Qwik的内容,但我想知道是否有任何基本了解组件渲染的人可以帮助我解决我的问题。我尝试将一个Supabase Auth UI放入我的component$函数中,如下所示:

import { component$ } from "@builder.io/qwik";

import { createClient } from "@supabase/supabase-js";
import { Auth } from '@supabase/auth-ui-react'

const supabase = createClient(`my-url`, `my-key`)

export default component$(() => {
    return (
        <Auth supabaseClient={supabase} />
    );
})

这产生了这个错误:

Internal server error: Cannot read properties of null (reading 'useState')
  File: /dist-dev/tsc-out/packages/qwik/src/core/util/implicit_dollar.js:1461:26
      at useState (C:\Users\isaac\Downloads\VS Code\planner\node_modules\react\cjs\react.development.js:1622:21)
      at k (file:///C:/Users/isaac/Downloads/VS%20Code/planner/node_modules/@supabase/auth-ui-react/dist/index.es.js:1211:48)
      at invoke (../../../dist-dev/tsc-out/packages/qwik/src/core/util/implicit_dollar.js:1461:26)
      at renderNode (../../../dist-dev/tsc-out/packages/qwik/src/core/util/implicit_dollar.js:4129:17)
      at processData$1 (../../../dist-dev/tsc-out/packages/qwik/src/core/util/implicit_dollar.js:4143:16)
      at ../../../dist-dev/tsc-out/packages/qwik/src/core/util/implicit_dollar.js:4210:26
      at Array.reduce (<anonymous>)
      at walkChildren (../../../dist-dev/tsc-out/packages/qwik/src/core/util/implicit_dollar.js:4195:21)
      at renderNodeVirtual (../../../dist-dev/tsc-out/packages/qwik/src/core/util/implicit_dollar.js:3688:21)
      at renderNode (../../../dist-dev/tsc-out/packages/qwik/src/core/util/implicit_dollar.js:4120:16) (x2)

这是否与延迟加载和useState在此组件渲染时的怪异有关?

ryoqjall

ryoqjall1#

如果不使用qwikify$(),就不能使用React组件
下面是一个工作的example

相关问题