Can't get Meteor's reactive container for React working with latest Meteor update


#1

Before I updated Meteor, I had two export default statements on a single page and imported data that way. Now, it gives me the Only one default export allowed per module error.

Fine, so I place the reactive container in it’s own page called editContainer.jsx:

import App from "./app.jsx";
import {createContainer} from 'meteor/react-meteor-data';

export default createContainer(function(){
console.log("It's working")
}, App);

Then in my App component:

import React from "react";
import "./editContainer.jsx";

export default class App extends React.Component {
  render() {
    return(
      <div>This is my app</div>
    )
  }
};

I get no response form the container. Placing a reference to the container via a variable and exporting that doesn’t work either. I get no response from the creative container and it’s driving me crazy. I tried numerous different ways of exporting the App component and importing the createContainer function, but nothing is working.


#2

It might be because the App component gets imported somewhere and you forgot to change the path from the component to container. Happens to me once in a while.


#3

Ugh. The problem was that I didn’t return an object from the createContainer function, therefore it never fired and when it did fire, it gave an error message regarding the aforementioned problem.


#4

I had a similar issue: react component rendered but createContainer/meteor subscription never fired.

I solved it by importing the component without braces:
import CompName from “…/CompName”