Skip to content

Am I allowed to use useState and useEffect when using signals? #651

Answered by JoviDeCroock
darix989 asked this question in Q&A
Discussion options

You must be logged in to vote

This works perfectly for me https://stackblitz.com/edit/vitejs-vite-1auxunjd?file=src%2Fapp.tsx not sure what you're seeing but this might be related to #630. Do you have any specific bundler that isn't vite or is your preact version older than 10.12 in your real application?

There might also be something going on where you forget to cleanup the set interval.

Being completely clear, this is expected to work but there are some nuances with state settling as lined out in that issue. Before that fix there was an issue where conflicting update could cause infinite loops, with the fix lined out in #630 mixing signals and state should work in everything as of v10.12.

That being said, I've heard…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
1 reply
@darix989
Comment options

Comment options

You must be logged in to vote
7 replies
@darix989
Comment options

@JoviDeCroock
Comment options

@darix989
Comment options

@darix989
Comment options

@darioRandazzoAccedo
Comment options

Answer selected by JoviDeCroock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants