How to use the inferno-router.match function in inferno-router

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

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github infernojs / inferno / packages / inferno-router / __tests__ / asyncBeforeBrowser.spec.jsx View on Github external
function didEnter() {
        requestAnimationFrame(() => {
          expect(innerHTML(container.innerHTML)).toBe(
            innerHTML("<div>Page No Async</div>")
          );
          done();
        });
      }

      const routes = (
        
          
        
      );

      const renderProps = match(routes, "/");
      doAllAsyncBefore(renderProps).then(() =&gt; {
        // Then render
        render(routes, container);
      });
    });
github infernojs / inferno / packages / inferno-router / __tests__ / asyncBeforeServer.spec.jsx View on Github external
it("should resolve nested asyncBefore", done =&gt; {
      const routes = (
        
          
            
          
        
      );

      const renderProps = match(routes, "/");
      doAllAsyncBefore(renderProps).then(() =&gt; {
        const html = InfernoServer.renderToString(
          createElement(RouterContext, renderProps)
        );
        expect(html).toBe(
          innerHTML(
            "<div>Page Two <span>data page two</span><div>Section <span>data section</span></div></div>"
          )
        );
        done();
      });
    });
github nightwolfz / inferno-starter / src / config / client.js View on Github external
history.listen(location => {
  onEnter(match(routes, location), context)
})
github iotexproject / iotex-explorer / src / lib / middleware / iso-render-middleware.js View on Github external
ctx.isoRender = ({vDom, reducer, clientScript}) => {
      const routes = vDom;
      const renderProps = match(routes, ctx.url);
      if (renderProps.redirect) {
        return ctx.redirect(renderProps.redirect);
      }

      ctx.body = html(ctx, renderProps, reducer, clientScript);
    };
    await next();
github nightwolfz / inferno-starter / server / middleware / render.js View on Github external
export default async(ctx) =&gt; {

  const renderProps = match(routes, ctx.url)
  const bundleURL = config.server.DEV ? `//localhost:2002` : ''

  if (renderProps.redirect) {
    return ctx.redirect(renderProps.redirect)
  }

  if (config.server.SSR) {
    try {
      await onEnter(renderProps, ctx.context)
    } catch(error) {
      throw error
    }
  }

  const components = config.server.SSR ? renderToStaticMarkup(

inferno-router

Provides routing functionality for Inferno

MIT
Latest version published 5 months ago

Package Health Score

79 / 100
Full package analysis