StaticRouter
interface StaticRouterProps {
children: ReactNode;
location: string;
context: Partial<RouterContextInterface>;
}
interface RouterContextInterface {
basename: string;
location: Location;
navigationType: Action;
isEqualToCurrentPathname: (to: To) => boolean;
createLink: (to: To) => Path;
isStaticContext: boolean;
statusCode?: number;
url?: string;
}
<StaticRouter> is used to render an ArchibaldRouter web app in node. Provide the current location via the location prop and server context via the context prop.
<StaticRouter location>defaults to"/"
import { StaticRouter } from '@archibald/core';
const app = (
<ServerProvider server={{ request, response }} store={store} head={manager}>
<StaticRouter location={initialLocation} context={context}>
<App />
</StaticRouter>
</ServerProvider>
);