Liam Idrovo
Liam Idrovo
TTCTheo's Typesafe Cult
Created by Liam Idrovo on 4/7/2024 in #questions
Get loading state from server action without using `useFormStatus` or `useFormState`
I like doing mutations with server actions because I don't have to write API routes and they remove the boilerplate of tRPC. But. Is there a way to get a loading state inside your component if i don't want to use the recommended experimental hooks? It leads to making my my own custom hook the exports a isLoading variable, which leads to believe I should just react query's useMutation to wrap the server action call just so I can the helpful isLoading and isError
2 replies
TTCTheo's Typesafe Cult
Created by Liam Idrovo on 5/25/2023 in #questions
Style based on scroll position
Can anyone help me style an element depending on if other elements are visible at a certain position? Put simply, I'm trying to copy the tailwind docs where the specific section label in the sidebar is highlighted when its corresponding content comes into view: https://tailwindcss.com/docs/scroll-snap-type
3 replies
TTCTheo's Typesafe Cult
Created by Liam Idrovo on 4/28/2023 in #questions
How does a React component require data to render in a SPA
I watching Theo's video on SSR https://youtu.be/kUs-fH1k-aM?t=358 and around 5:58 he mentions that in a SPA a user doesn't see anything until the data is loaded, unless you've got loading spinners telling the user data is incoming. Having only every used fetch inside useEffect or React Query in SPAs, I've always fetched data once components have rendered. Can anyone show me an example of a component in a SPA that doesn't render until data is fetched? I don't know how this would look like exactly in a React component.
4 replies