Skip to content

Commit

Permalink
test: Count renders with various options
Browse files Browse the repository at this point in the history
  • Loading branch information
franky47 committed Dec 31, 2024
1 parent 5df9b85 commit f2e6052
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/e2e/remix/app/routes/sync.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import { useQueryState, parseAsInteger } from 'nuqs'
import { parseAsInteger, useQueryState } from 'nuqs'

function Test({ id }: { id: number }) {
console.log(`render test ${id}`)
const [state, setState] = useQueryState(
'test',
parseAsInteger
.withDefault(0)
.withOptions({ shallow: false })
parseAsInteger.withDefault(0).withOptions({ shallow: false })
)
return <button onClick={() => setState(c => c + 1)}>{state}</button>
}

const delay = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))

export async function loader() {
await delay(500)
return null
}

export default function Page() {
console.log('page render')
return (
Expand Down

0 comments on commit f2e6052

Please sign in to comment.