Can I use Reactive Variables as a state management solution?
I mean using Reactive Variables without typePolices or local state is alright?
While I’m using Reactive Variables as state management solution (like Context API or Redux) I wonder that this is a right way to use Reactive Variables.
When I searched about Reactive Variables, there are a lot of examples. But, Almost all of them are using Reactive Variables with typePolices or local-only query.
So I think that using Reactive Variables without them is wrong.
If using Reactive Variables without typePolices or local-only query is wrong, I have to use another state management solution.
My team is trying to decide on the best state management solution for our web app, and since we already use Apollo Client for handling queries and mutations it kind of makes sense to leverage reactive variables.
Since useReactiveVar is now a thing, it seems like writing queries for local state is no longer required. If I’m not mistaken, it seems like all you would need to do is define your variable and use the hook in the components that rely on the data. No need to fuss with type policies and @client directives. This seems too good to be true, ha!
Are there any best practices with using reactive variables as state management? Is it possible to co-locate variables to a specific area of your app, and not expose them to other component trees?