Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

React transmit components not getting rendered #60

Open
pastelsky opened this issue Feb 26, 2016 · 2 comments
Open

React transmit components not getting rendered #60

pastelsky opened this issue Feb 26, 2016 · 2 comments

Comments

@pastelsky
Copy link

When I export the dumb component (React component), everything works fine, although, when exporting the container provided by react transmit, the component stops rendering and no error is shown.

Component

import React from "react";
import JsSdk from "../../api";
import Transmit from "react-transmit";

 class Search extends React.Component {
 /* exporting this class renders the component perfectly */
  render() {
    return (
      <div>
        <h1>Search Page { this.props.result.toString() }</h1>
      </div>
    );
  }
}

export default Transmit.createContainer /* Doesn't render */ (Search, {
  fragments: {
    result() {
      return JsSdk.search.suggestFor("Arab");
    },
  },
});

Server.js

app.use(function *(next) {
    yield ((callback) => {
      match({routes, location}, (error, redirectLocation, renderProps) => {

        Transmit.renderToString(RouterContext, renderProps).then(({reactString, reactData}) => {
          let template = (
            `<!doctype html>
                <html lang="en-us">
                    <body>
                        <div id="react-root">${reactString}</div>
                    </body>
                </html>`
          );
        this.body = template;
          callback(null);
        }).catch(e => {
          callback(e);
        });
      });
    });
  });
@EvHaus
Copy link

EvHaus commented Mar 1, 2016

I'm having the same issue as well.

@tmadison-gpsw
Copy link

See #57 and #59, initialVariables must be defined on root containers even if you do not use any.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants