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

[React] Using Telefunc for initial SSR data (like Next.js's Server Actions) #102

Open
brillout opened this issue Mar 10, 2024 · 0 comments
Labels
enhancement ✨ New feature or request high-prio 💫

Comments

@brillout
Copy link
Owner

brillout commented Mar 10, 2024

Thanks to the SSR streaming capabilities of React 18, Telefunc can be used for fetching the initial SSR data. (Instead, for example, of using Vike's data() hook.)

You can already do that today by using Telefunc with the useAsync() component hook of react-streaming.

If you use vike-react, vike-react already installs react-streaming.

If you use vike-react-query, then see vike-react-query > Usage with Telefunc. (Such Telefunc + React Query usage is very much recommended if you want to use React Query. This ticket is about having integrations without using React Query.)

Warning

There is also an integration with react-streaming built directly into Telefunc, but it isn't ready for public usage yet and breaking change will occur. You can play around with it at /examples/react-streaming. But you're warned: the API as it is today will be deprecated.

@brillout brillout changed the title Integration with vike-react [React] Using Telefunc for initial SSR data (like Next.js's Server Actions) Jun 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request high-prio 💫
Projects
None yet
Development

No branches or pull requests

1 participant