How to use the fusion-react function in fusion-react

To help you get started, we’ve selected a few fusion-react examples, based on popular ways it is used in public projects.

github fusionjs / fusionjs / fusion-plugin-service-worker / fixture-apps / app / src / main.js View on Github external
export default () => {
  const app = new App(root);
  app.register(Styletron);
  app.register(Router);

  app.register(SwPlugin);
  if (__BROWSER__) {
    app.register(SWRegisterToken, true);
  }
  if (__NODE__) {
    app.register(SWTemplateFunctionToken, swTemplateFunction);
    const expiry = parseInt(process.env.EXPIRY, 0);
    if (expiry) {
      app.register(SWOptionsToken, {cacheDuration: expiry});
    }
    if (process.env.CACHE_BUSTING_PATTERNS) {
      app.register(SWOptionsToken, {
        // $FlowFixMe
github fusionjs / fusionjs / fusion-plugin-rpc-redux-react / src / __tests__ / index.browser.js View on Github external
loading: false,
        };
      },
    }),
    prepared(props =>
      props.message ? Promise.resolve() : props.test({hello: 'world'})
    ),
    connect(s => s)
  );

  const element = React.createElement(
    Provider,
    {store},
    React.createElement(hoc(Component))
  );
  const app = new App(element);
  app.register(RPCPluginMock);
  app.register(RPCHandlersToken, handlers);
  await getSimulator(app)
    .render('/')
    .catch(e => t.equal(e.message, 'Some failure'));
  t.equal(expectedActions.length, 0, 'dispatches all actions');
  t.equal(flags.start, true, 'dispatches start action');
  t.equal(flags.failure, true, 'dispatches failure action');
  teardown();
  t.end();
});
github fusionjs / fusionjs / fusion-plugin-react-helmet-async / src / __tests__ / request.node.js View on Github external
test('Non render request', async t => {
  const app = new App(React.createElement('div'), el => el);
  app.register(HelmetPlugin);
  const sim = getSimulator(app);
  const ctx = await sim.request('/');
  t.equal(ctx.element, null, 'does not wrap ctx.element');
  t.end();
});
github fusionjs / fusionjs / fusion-plugin-apollo / src / __tests__ / server.node.js View on Github external
function testApp(el, {typeDefs, resolvers}) {
  const app = new App(el);
  const schema = makeExecutableSchema({typeDefs, resolvers});
  app.enhance(RenderToken, ApolloRenderEnhancer);
  app.register(GraphQLSchemaToken, schema);
  app.register(ApolloClientToken, ApolloClientPlugin);
  return app;
}
github fusionjs / fusion-cli / test / e2e / json-static-assets / fixture / src / main.js View on Github external
export default async function start() {
  const app = new App(<Home />);
  return app;
}
github fusionjs / fusionjs / fusion-plugin-react-router / src / __tests__ / plugin.js View on Github external
function getApp(el) {
  const app = new App(el);
  app.register(RouterToken, RouterPlugin);
  return app;
}
github fusionjs / fusion-cli / test / fixtures / dynamic-import-app / src / main.js View on Github external
export default async function start() {
  const app = new App(<Root />);
  app.register(Router, {});
  app.register(UniversalEventsToken, UniversalEvents);
  __BROWSER__ && app.register(FetchToken, window.fetch);
  return app;
}
github fusionjs / fusion-cli / test / fixtures / server-render-error / src / main.js View on Github external
export default () => {
  const app = new App(<Switch>
    <Route exact path="/" component={Home} />
  </Switch>);
  app.register(Router);
  __BROWSER__ && app.register(FetchToken, window.fetch);
  app.register(UniversalEventsToken, UniversalEventsPlugin);
  return app;
};
github fusionjs / fusion-cli / test / e2e / hmr-simple-app / fixture / src / main.js View on Github external
export default async function start() {
  const app = new App(home());
  return app;
}

fusion-react

FusionJS entry point for React universal rendering

MIT
Latest version published 2 months ago

Package Health Score

77 / 100
Full package analysis

Similar packages