createMemoryHistory
An in-memory history for tests, servers and non-browser hosts.
An in-memory history for tests, servers and non-browser hosts.
Import#
ts
import { createMemoryHistory } from "@shadow-js/router";
Signature#
ts
function createMemoryHistory(options: MemoryHistoryOptions = {}): History
Parameters#
| Name | Description |
|---|---|
options |
Initial stack, index and flush scheduler. |
Returns#
A history whose stack lives in this object.
Examples#
ts
const history = createMemoryHistory({ initialEntries: ["/", "/about"] });
history.push("/posts/1");
history.back();