Closed malinjr07 closed 9 months ago
I found the Solution. First, @preact/signals-react works just fine with the Next.js 13, page Router.
Steps to Verify:
npx create-next-app@latest
npm i @preact/signals-react
or yarn add @preact/signals-react
useSignal
hook outside of a component. If you want to declare signal outside of a component, use signal
function instead:
import { signal } from '@preact/signals-react';
export const welcomeText = signal('Awesome!');
4. **Must Do** Reload the website after implementation;
Description
I'm Exploring @preact/signals-core with the Nextjs 13 (page router). I've initialized the state:
Now, in the console log, the Signal is updating:
The Result screenshot:
File Directory:
Expected behavior
Rerender should happen on the value area, and the value should update on the DOM (Marked in Red).
Actual behavior
The value is not updating in the dom on click.