Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: @suspensive/page & deprecate wrap #1202

Open
manudeli opened this issue Aug 8, 2024 · 0 comments
Open

[Feature]: @suspensive/page & deprecate wrap #1202

manudeli opened this issue Aug 8, 2024 · 0 comments
Assignees

Comments

@manudeli
Copy link
Member

manudeli commented Aug 8, 2024

Package Scope

@suspensive/react, etc

Description

const App = () => {
  return (
    <PageProvider adapter={reactRouteDomAdapter}>
      <Switch>
        <Route path={UserPage.route({ userId: ':userId' })} component={UserPage} />
      </Switch>
    </PageProvider>
  )
}

const UsersPage = page(({ userId }: { userId: number }) => `/users/${userId}`)({
  errorFallback: () => <Box.Error>Failed to load user</Box.Error>,
  loadingFallback: <Spinner />,
  queryParamsParse: z.object({
    user_id: z.coerce.number(),
  }).parse,
  loader: async ({ queryParams }) => {},
  component: ({ queryParams, loadedData }) => {
    return <Deep />
  },
})

const Deep = () => {
  const router = useRouter()
  const queryParams = UserPage.useQueryParams()

  const handleClickRouteButton = router.push(UserPage.route({ userId: user_id }))

  return <></>
}

Possible Solution

No response

etc.

No response

@manudeli manudeli self-assigned this Aug 8, 2024
@manudeli manudeli changed the title [Feature]: @suspensive/page [Feature]: @suspensive/page & deprecate wrap Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant