Hi there!
I recently started at a new place where we use Meteor in the backend and React in the frontend.
At my last job I did a lot of React but I have never used Meteor before.
Reading through the guides I thought using subscriptions would be a breeze with withTracker
. And then there even is a useTracker
-hook now
It’s a somewhat dated code base. I saw some createContainer
-HOC usages and import { createContainer } from 'react-meteor-data'
And lots and lots of direct Tracker.autoruns
in componentDidMount
s and useEffect
-Calls.
And two ominous commented // import { withTracker } from 'meteor/react-meteor-data'
right before two of those createContainer
-imports.
So I went and created a custom hook that imported useTracker
from 'meteor/react-meteor-data'
but couldn’t get it to run because
TypeError: _reactMeteorData is undefined
Then it dawned on me: This was a create-react-app and not a meteor react app and I couldn’t meteor add
anything in here. Although autocomplete inside the curlies here import { } from 'meteor/react-meteor-data'
did suggest withTracker
and useTracker
, following the imported symbols went to cached npm meteor lib inside my user hard disc user data.
So long story short, here’s my question: Is there any way to use an atmosphere package in a create-react-app (long time ago it was ejected: I’m updating to webpack v2 from v1 right now…)?
Thanks in advance for any help you can provide.
In the meantime I guess I just use Tracker directly in my custom hook