Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

Counter.tsx

20 lines461 Bytes

1import { Stack } from '@mui/material'
2import { useSearch } from '@tanstack/react-router'
3import { CustomButtonLink } from '~/components/CustomButtonLink'
4​
5export function Counter() {
6 const { count = 0 } = useSearch({ from: '/' })
7​
8 return (
9 <Stack>
10 <CustomButtonLink
11 variant="contained"
12 size="large"
13 to={'/'}
14 search={{ count: count + 1 }}
15 >
16 Clicks: {count}
17 </CustomButtonLink>
18 </Stack>
19 )