Skip to content

Commit

Permalink
doc: Add step comments
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 committed Nov 23, 2023
1 parent f339e6a commit fcd61f2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,15 @@ import React from 'react'
import { useQueryState, parseAsString } from 'next-usequerystate'

function ClientComponent({ data }) {
// 1. Provide your own useTransition hook:
const [isLoading, startTransition] = React.useTransition()
const [query, setQuery] = useQueryState(
'query',
// 2. Pass the `startTransition` as an option:
parseAsString().withOptions({ startTransition })
)
// 3. `isLoading` will be true while the server is re-rendering
// and streaming RSC payloads, when the query is updated via `setQuery`.

// Indicate loading state
if (isLoading) return <div>Loading...</div>
Expand Down

0 comments on commit fcd61f2

Please sign in to comment.