luisherranz / deepsignal

DeepSignal 🧶 - Preact signals, but using regular JavaScript objects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for @preact/signals-react with DeepSignals

Sumit2202 opened this issue · comments

I am using @preact/signals-react with react-native and it works but in many places I have a deeply nested object, to which I need to listen to property changes and re-render accordingly.
DeepSignals with @preact/signals-react would be the ideal solution.

Can you test if this works?

import "@preact/signals-react"
import { deepSignal } from "deepsignal/core";

// ...

EDIT: You don't need to add the import "@preact/signals-react" each time you import deepSignal. Doing it just once should be enough.

It did not work, here is the stackblitz

It's working fine using Vite: https://stackblitz.com/edit/vitejs-vite-arvs9j?file=src%2Fmain.tsx

The error Cannot use import statement outside a module doesn't seem related to using deepsignal in React, but to the bundling.

Closing as it works fine with React. I'll investigate the import issue, though.

I'm unable to reproduce the problem locally. If I download the Stackblitz project and run it locally, there is no import error.

It works fine using CRA locally or in Codesandbox, and it works fine using Vite in Stackblitz 🤷‍♂️

Could you please update to 1.1.3 and check if it works on your project?