Searching this forum for any advice on useReactiveVars
shows the following:
The official docs explaining how to modify a reactiveVar abusively give zero code examples:
all you need to do is set the reactive variable’s new value
- H - O - W - does one do this?
Google results are scattered throughout the years, the alpha, the beta, and the terrible opinions on how to do anything with useReactiveVar
Is the useReactiveVar
feature even still supported in Apollo or is it yet another vestigial concept that died like local resolvers? I wouldn’t know because all search results, documentation, and community discussion is basically a Tower of Babel on the topic.
The cause of my problems came from useReactiveVar
not triggering a re-render.
This solution helped: spread the variable to a new object so the new reference triggers a state change, and thus, cascades a new render.
That would be VERY NICE FOR A TUTORIAL TO EXPLICITLY MENTION, BTW
https://github.com/apollographql/apollo-client/issues/7779#issuecomment-789944090
1 Like
Sorry to hear about the frustration this has caused! useReactiveVar
is definitely supported, and we’re going to adding many more reactive features in the future. Not including more docs on useReactiveVar
is an oversight, which we’ll get resolved. Thanks!
1 Like
Oh, and just to add about not finding anything in these forums - that’s just because these forums launched this week! New discussions are trickling in, and will start to pick up speed as we get the word out.
3 Likes