I’m looking for a good example of how to create Meteor package that exposes a React class for Meteor 1.3. Right now, I’m using NPM installed React, React DOM, Material-UI etc.
How to handle the dependencies: Will putting putting those dependencies (React, React DOM, etc.) in the Npm.depends(…) function in package.js work, or is this a separate set of logic that’s not smart enough to know whether I’ve got NPM packages installed globally?
What’s the syntax for exposing the React class?
What’s the syntax for consuming the React class in my client code?
I’ve looked at markoshust:material-ui, but I’m not sure it’s the most up-to-date pattern, and I wasn’t able to get it to work in any case.
Take my advice with a grain of salt, as this is just my own experience and should probably be confirmed, but I don’t recommend using Npm.depends, at is can easily lead to conflicts with peer dependencies and the “multiple versions of React” error. Instead, users should separately install the packages your package depends on via NPM.
Also, as far as I can tell you can’t yet publish to Atmosphere a package that uses api.mainModule.