Skip to content

Commit

Permalink
Use sample for all route methods
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeysova authored Jan 26, 2024
1 parent e6127dd commit 5512743
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions docs/api/create-route.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,15 @@ sample({
You can also add `replace: true` option to do `history.replace` instead of `history.push`:

```ts
postRoute.navigate({
params: { postId: '123' },
query: { foo: 'bar' },
replace: true,
});
sample({
clock: someThingHappened,
fn: () => ({
params: { postId: '123' },
query: { foo: 'bar' },
replace: true,
}),
target: postRoute.navigate,
})
```

**Signature:** `Effect<RouteParamsAndQuery<RouteParams> & { replace?: boolean }, RouteParamsAndQuery<RouteParams>>`
Expand All @@ -65,7 +69,11 @@ postRoute.navigate({
The same as `.navigate` but with params only

```ts
postRoute.open({ postId: '123' });
sample({
clock: somethingHappened,
fn: () => ({ postId: '123' }),
target: postRoute.open,
})
// /posts/:postId -> /posts/123
```

Expand Down

0 comments on commit 5512743

Please sign in to comment.