How to replace useObserver in store hooks? #2712
-
We use hooks to get different parts of the store into components, according to previous documentantion:
Since useObserver is deprecated, I've tried to replace it with or observer(), but always got TS errors. Can you please share the proper solution? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
If don't tell us what errors you have, we can't really help you :) Either way, just drop |
Beta Was this translation helpful? Give feedback.
-
No matter if I completely remove type for this hook, it always shows errors. Looks like and observer() should be used with React components, but my hook returns an object. |
Beta Was this translation helpful? Give feedback.
If don't tell us what errors you have, we can't really help you :)
Either way, just drop
useObserver
and stickobserver
on the consuming component. It can "see" inside the hook call and access to observables.