Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
asyncBefore={url => {
// console.log('Async before...')
return doAllAsyncBefore(match(routes, url));
}}
>
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);
});
});
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();
});
});