Draëcal
Draëcal
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Draëcal on 11/1/2023 in #questions
Preact signals in Nextjs14 + AppRouter
I was trying to use signals within the setup above but either the signal updates but no re-rendering happens or I just get a server error.
'use-client'
import Image from 'next/image'
import { signal } from '@preact/signals-react'

const toOpen = signal(false)
const signalChange = () => { toOpen.value = true ; console.log(toOpen)}

export default function Home() {
return (<> <p>The current status is: {String(toOpen.value)}</p><button onClick={signalChange }>Change status</button></>)
'use-client'
import Image from 'next/image'
import { signal } from '@preact/signals-react'

const toOpen = signal(false)
const signalChange = () => { toOpen.value = true ; console.log(toOpen)}

export default function Home() {
return (<> <p>The current status is: {String(toOpen.value)}</p><button onClick={signalChange }>Change status</button></>)
The server error:
Server Error
Error: Cannot set property createElement of [object Module] which has only a getter
Server Error
Error: Cannot set property createElement of [object Module] which has only a getter
3 replies