Closed merunga closed 9 years ago
Don't forget to export the variable in package.js:
api.export("Leaderboard", ["client", "server"]);
As a rule, variables for packages:
var
=> file onlyvar
=> package onlyvar
and in api.export
=> available to appTemplates are always exported, aren't they? And the react mixin creates a real spacebar template, doesn't it? Or maybe i don't completely get how it works...
Either way, I tried what you said, didn't work either.
@froatsnook are you using react components inside your packages already?
@merunga No, I'm not using react components inside packages. At first glance it looked like a generic package export problem.
I'll take a look :)
OK at least the Leaderboard variable is now exported by the package. So you could do:
Template.yourTemplate.onRendered(function() {
var container = this.find("#container");
React.render(React.createElement(Leaderboard, { }), container);
});
This is definitely a react-meteor bug. It needs api.use("templating")
in package.js. I submitted a pull request, but not sure when it will be merged in. I guess you could clone react-meteor and cherry-pick this commit? Also make sure to check out #77. I'm currently working from a local copy!
I cloned locally the package and added templating
to the dependencies... that did the trick. Thanks @froatsnook !
In the example if I move the
leaderboard.jsx
file into a package, the templateLeaderboard
is not found:Uncaught Error: No such template: Leaderboard
inblaze/lookup.js
Here's a reproduction repo, deployed here.