Add useAutorun and useReaction hooks #3030
Replies: 3 comments 6 replies
-
In my opinion it shouldn't be included in the core. People use Mobx in different ways because it doesn't enforce any architectural patterns. In our team we try to not mix mobx specifics (like autorun/reaction) with components. Moreover we try to avoid autorun/reaction as much as possible: #1006 (comment) |
Beta Was this translation helpful? Give feedback.
-
Actually very tricky, check mobxjs/mobx-react#772 Eg. in your impl, when |
Beta Was this translation helpful? Give feedback.
-
I've implemented an almost identical I would go as far as calling @LandonSchropp have you, or anyone else, run into problems, or see any problems with the |
Beta Was this translation helpful? Give feedback.
-
In my current project, I've built
useAutorun
anduseReaction
hooks. These have turned out to be very useful for my project, and I thought they'd be helpful for other people as well. I think they'd make sense as part of the mobx-react-lite package.I know these functions aren't many lines of code, but I still think it's worth including them because getting them right was a little tricky and took me a few tries.
Please let me know if you'd like some examples of how I'm using these hooks and why they were helpful. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions