Closed xymopen closed 4 months ago
I am not sure that signals support usage with class component, but certainly it shouldn't throw with such strange error
I am not sure that signals support usage with class component
We absolutely do. Unlike React, class components are first-class citizens in Preact and we've advertised their usage with signals numerous times on Twitter.
Modifying state in the constructor is discouraged in general though, would be better to leverage a lifecycle for these I reckon 😅 i.e. like this https://stackblitz.com/edit/vitejs-vite-t6wyct?file=src%2Fmain.tsx,package.json,src%2Findex.css&terminal=dev
I see. Feel free to close it.
Environment
@preact/signals-core
@preact/signals
@preact/signals-react
To Reproduce
Error:
Uncaught (in promise) TypeError: o.__ is null
Note
Remove signal modification from constructor can suppress the error.
Wrap
<App />
in another component can also suppress the error.