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

React transmit components not getting rendered #60

Description

@pastelsky

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);
        });
      });
    });
  });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions