Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
aralroca authored Apr 26, 2024
1 parent 7dd2981 commit 87f5e94
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ _(Example with JSX)_

The `diff-dom-streaming` library takes into account the `key` attribute for these cases, if it does not exist, then see if they have `id`.

## Transitions between pages (View Transition API)
## Transitions between pages (View Transition API)

You can activate the View Transition API updating the DOM with this property:

Expand All @@ -118,6 +118,18 @@ await diff(document, res.body.getReader(), {
})
```

### Incremental vs full transition

Many times it will make more sense to use a complete transition instead of incremental, especially if we do not use suspense and we want a single transition at once instead of several, in this case, instead of using the configuration, we can use the View Transition API directly:

```diff
+ document.startViewTransition(async () => {
await diff(document, res.body.getReader(), {
- transition: true,
});
+});
```

## Examples

In the repo we have examples for you to try.
Expand Down

0 comments on commit 87f5e94

Please sign in to comment.