Closed mbabauer closed 7 years ago
Can anyone help me understand why this component is getting stuck at "Loading..."?
You're not passing any data in your composer
function.
If you call onData()
with no arguments then you put the component into a loading state.
You need to call it like this:
export const composer = ({context}, onData) => {
// like this if you don't have data
onData(null {});
// or like this with data
const user = Meteor.users.findOne();
onData(null, {
user
});
};
Thanks. I should have closed this, but the solution I took was to simply remove the composer method and the call to composeWithTracker(). So, basically all I call is the useDeps() in the composeAll() call, since all I need to do is set the actions for the component.
If you're not side-loading data you definitely shouldn't be using react-komposer
. If you're simply looking to map some props or add handlers you should look at recompose
.
For this particular component I only needed to inject some actions (I am using Meteor Mantra). I didn't know how else to make the actions available to the component, to be perfectly honest, and examples are all over the place with how they approach stuff. If you have some better examples I would absolutely love to follow them.
I don't use Mantra and I'm not really familiar with it so I can't help you there unfortunately.
I have a component defined as follows:
But, when I load said component I get "Loading...". I also tried to call
onData()
asonData(null, {})
, but that throws an error in Tracker. I just need to pass in the actions, no data, to the component.