How to use the inferno-router.doAllAsyncBefore 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
asyncBefore={url => {
            // console.log('Async before...')
            return doAllAsyncBefore(match(routes, url));
          }}
        >
github infernojs / inferno / packages / inferno-router / __tests__ / asyncBeforeBrowser.spec.jsx View on Github external
const routes = (
        
          
        
      );

      // Need to prime the route props with data on first render. With SSR this should be done by hydration
      // so makes sense not to perform automagically in router.
      const renderProps = match(routes, "/");
      doAllAsyncBefore(renderProps).then(() => {
        // Then render
        render(routes, container);
      });
    });
github infernojs / inferno / packages / inferno-router / __tests__ / asyncBeforeServer.spec.jsx View on Github external
it("should resolve multiple nested asyncBefore", done => {
      const routes = (
        
          
            
          
        
      );

      const renderProps = match(routes, "/");
      doAllAsyncBefore(renderProps).then(() => {
        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();
      });
    });

inferno-router

Provides routing functionality for Inferno

MIT
Latest version published 5 months ago

Package Health Score

79 / 100
Full package analysis