为了在 Deno Fresh 中使用 Reveal.js,我在岛上使用了以下代码:
import { useEffect } from "https://esm.sh/v128/[email protected]/hooks/src/index.js";
import Reveal from '../reveal/js/index.js';
export default function Island() {
useEffect(()=> {
setDeck(new Reveal());
deck.initialize();
})
return <>Text</>
}
我认为这是使用钩子的正确方法,但我收到此错误:
An error occurred during route handling or page rendering.
3 |
4 | export default function Island() {
> 5 | useEffect(()=> {
| ^
6 | newFunction();
7 |
8 | function newFunction() {
TypeError: Cannot read properties of null (reading '__hooks')
at s (https://esm.sh/stable/[email protected]/denonext/hooks/src.js:2:1339)
at G (https://esm.sh/stable/[email protected]/denonext/hooks/src.js:2:2385)
at Object.Island (file:///D:/Programming/Test/fresh-project/islands/Island.jsx:5:3)
at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3237)
at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:2543)
at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
at m (https://esm.sh/v135/[email protected]/X-ZS8q/denonext/preact-render-to-string.mjs:2:3802)
会发生什么?