diff --git a/README.md b/README.md index 4291cf8..7340069 100644 --- a/README.md +++ b/README.md @@ -788,6 +788,15 @@ const handleRequest = (req, res) => { }; ``` +Tip: wouter can pre-fill `ssrSearch`, if `ssrPath` contains the `?` character. So these are equivalent: + +```jsx +; + +// is the same as +; +``` + On the client, the static markup must be hydrated in order for your app to become interactive. Note that to avoid having hydration warnings, the JSX rendered on the client must match the one used by the server, so the `Router` component must be present. diff --git a/packages/wouter/src/index.js b/packages/wouter/src/index.js index a8a41ed..1739acc 100644 --- a/packages/wouter/src/index.js +++ b/packages/wouter/src/index.js @@ -116,7 +116,7 @@ export const Router = ({ children, ...props }) => { // holds to the context value: the router object let value = parent; - // when `ssrPath` contains a `?` character, we split can extract the search + // when `ssrPath` contains a `?` character, we can extract the search from it const [path, search] = props.ssrPath?.split("?") ?? []; if (search) (props.ssrSearch = search), (props.ssrPath = path);