shiroyasha9
shiroyasha9
TTCTheo's Typesafe Cult
Created by fero.xd on 11/15/2023 in #questions
Making a page static
Sharing a snippet of your code will help a lot, as it is not possible to tell what might be going wrong just from the context.
3 replies
TTCTheo's Typesafe Cult
Created by Paddy on 11/16/2023 in #questions
'Correct' Development use, Folder Structure in T3 Tech Stack App
https://nextjs.org/learn I will highly recommend you to follow along with this free learning course by Next.js team. It will help you better understand all app router related concepts and workflows.
5 replies
TTCTheo's Typesafe Cult
Created by Paddy on 11/16/2023 in #questions
'Correct' Development use, Folder Structure in T3 Tech Stack App
I have also worked on some repos that use components folder only for the reusable code, and all the client components for a particular path goes to the /app/[path for which this was created]/_components/. For example, /app/login/_components/LoginButton.tsx There is no decisive answer here, it all depends on your preference.
5 replies
TTCTheo's Typesafe Cult
Created by Paddy on 11/16/2023 in #questions
'Correct' Development use, Folder Structure in T3 Tech Stack App
Let's start with Question #2: You are indeed correct. Any code that needs to be shared across multiple pages should be added to the layout.tsx file. This includes elements like the navbar, footer, drawers, etc. Regarding Question #1, it's a bit more complex, particularly with the introduction of server components. Previously, the components folder was reserved for reusable code, and you wouldn't typically create new components for elements used only once, like a navbar or footer. However, with server components, if you need to include a client component within a server component, you must refactor the client code into a separate file as a separate component. This approach deviates from the original React principle of components being reusable code. There's no definitive answer here, but currently, I handle components in the following manner: - Truly reusable components are placed in /components/ui/ (inspired by shadcn). - Other components, created due to the client component architecture, are stored in /components/[path for which this was created]/. For example, /components/login/LoginButton.tsx.
5 replies
TTCTheo's Typesafe Cult
Created by Max on 9/18/2023 in #questions
anyone else think app directory is not worth?
21 replies
TTCTheo's Typesafe Cult
Created by Max on 9/18/2023 in #questions
anyone else think app directory is not worth?
I didn't have to change a single line in my api routers, it was just the utils file and the trpc file which setups the context
21 replies
TTCTheo's Typesafe Cult
Created by Max on 9/18/2023 in #questions
anyone else think app directory is not worth?
I wasn't able to find a working solution for the TRPCNext, and so had to resort to the React package. I had followed a video from Jack Herrington for this implementation, and then added things like context to it. Video - https://youtu.be/qCLV0Iaq9zU?si=hKh33k6ZNy6aavCI
21 replies
TTCTheo's Typesafe Cult
Created by Jaaneek on 9/21/2023 in #questions
ideas for projects
Now you know what to build - a better idea generator
8 replies
TTCTheo's Typesafe Cult
Created by West side ⁉ on 9/22/2023 in #questions
createServerSideHelpers not offering mutation routes!
createServerSideHelpers is used to prefetch queries on the server. (taken from the official documentation) https://trpc.io/docs/client/nextjs/server-side-helpers#:~:text=can%20use%20to-,prefetch%20queries,-on%20the%20server If you want to use mutations in a server component, you can check this out - https://trpc.io/docs/server/server-side-calls#mutation-example
6 replies
TTCTheo's Typesafe Cult
Created by ebitzu. on 9/16/2023 in #questions
I got some free time while on bench, who wants some JS help
I watched this video recently, and I feel this is the best way to ensure that the user can revisit the link anytime and get to the state they were previously at - https://www.youtube.com/watch?v=ukpgxEemXsk TLDR: Use the route params for the state management, which you can then use to populate the page.
4 replies
TTCTheo's Typesafe Cult
Created by Shampurrrs on 9/23/2023 in #questions
CreateTRPCNext<AppRouter> showing typescript error.
Can you upload your code on github and share a link so that we can try it locally?
4 replies
TTCTheo's Typesafe Cult
Created by jeff.kershner on 9/24/2023 in #questions
Shadcn-ui -> React Server Components
If you are not trying any experimental branches where app router is present, it should be alright to say "no" to the prompt.
4 replies
TTCTheo's Typesafe Cult
Created by Jaaneek on 9/21/2023 in #questions
ideas for projects
Try some AI idea generators like https://appideagenerator.com/ https://ideasai.com/
8 replies
TTCTheo's Typesafe Cult
Created by hyhy on 9/20/2023 in #questions
Refreshing NextAuth Discord provider user details
"I'm a vim user btw" 🤪 the theme is catppuccin, there is a VS Code extension for it as well!
15 replies
TTCTheo's Typesafe Cult
Created by mosesintech on 9/20/2023 in #questions
TypeScript error: Type 'string' is not assignable to union value
Type assertion is your way of telling typescript to shut up and assume that the type will always be what you mention. Simply speaking, it is the equivalent of "trust me bro". We can do one of the following things here - 1. Add runtime validation check - use a library like zod where you define a schema (formSchema) and parse your data against that. It the data does not match schema, it throws an error which you can handle. 2. Convert the query.json file to a .ts file - This will help you define an object with the specified Form type.
export const data: Form[] = [{...}]
export const data: Form[] = [{...}]
This way typescript will properly check the values and show you an error if you have written a value incorrectly. The error will however not be shown at the place of usage, but rather where you define the data (query.ts) in this example.
10 replies
TTCTheo's Typesafe Cult
Created by mosesintech on 9/20/2023 in #questions
TypeScript error: Type 'string' is not assignable to union value
Glad to be here 🤝🏼
10 replies
TTCTheo's Typesafe Cult
Created by mosesintech on 9/20/2023 in #questions
TypeScript error: Type 'string' is not assignable to union value
Typescript infers the types from the json to be plain types like string, and so you can assert type for it to be proper. To do so you can do the following, where Form is the type you defined
import data from "../data/query.json"
const mockData = data as Form
import data from "../data/query.json"
const mockData = data as Form
10 replies
TTCTheo's Typesafe Cult
Created by hyhy on 9/20/2023 in #questions
Refreshing NextAuth Discord provider user details
Glad to be here 🤝🏼
15 replies
TTCTheo's Typesafe Cult
Created by Will on 9/20/2023 in #questions
As a nextjs + shadcnui user going to expo + react native, what libraries should I know about?
Definitely https://nativewind.dev/ It basically let's you write 90% of tailwind in react native (some minor things do not work, as they cannot be replicated on mobile). It's amazing just how big of a developer experience jump it makes and my go-to now for new projects.
8 replies
TTCTheo's Typesafe Cult
Created by mosesintech on 9/20/2023 in #questions
TypeScript error: Type 'string' is not assignable to union value
It should work. How are you testing it? I mean, can you share the instance of where do you get that error?
10 replies