Skip to content

Commit

Permalink
Typos and README updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
molefrog committed Mar 3, 2024
1 parent 574477c commit 3fb98e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,15 @@ const handleRequest = (req, res) => {
};
```

Tip: wouter can pre-fill `ssrSearch`, if `ssrPath` contains the `?` character. So these are equivalent:

```jsx
<Router ssrPath="/goods?sort=asc" />;

// is the same as
<Router ssrPath="/goods" ssrSearch="sort=asc" />;
```

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.
Expand Down
2 changes: 1 addition & 1 deletion packages/wouter/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 3fb98e5

Please sign in to comment.