tom0619
tom0619
TTCTheo's Typesafe Cult
Created by Vadims on 7/17/2023 in #questions
Deployed app not showing time in date
Do you have any code to format the date? My guess is that it's something to do with the timezone set on your local machine vs the timezone of the server
6 replies
TTCTheo's Typesafe Cult
Created by Max on 12/31/2022 in #questions
Next router is possibly undefined, leading to query with undefined input
29 replies
TTCTheo's Typesafe Cult
Created by Max on 12/31/2022 in #questions
Next router is possibly undefined, leading to query with undefined input
So many ways to see if something is defined 😦
29 replies
TTCTheo's Typesafe Cult
Created by Max on 12/31/2022 in #questions
Next router is possibly undefined, leading to query with undefined input
Personally I like to wrap them in a Boolean constructor, instead of using !! Boolean(packID)
29 replies
TTCTheo's Typesafe Cult
Created by Max on 12/31/2022 in #questions
Next router is possibly undefined, leading to query with undefined input
tRPC wraps react query and react query has a tone of useful options
29 replies
TTCTheo's Typesafe Cult
Created by Max on 12/31/2022 in #questions
Next router is possibly undefined, leading to query with undefined input
Do const packID = query... as string
29 replies
TTCTheo's Typesafe Cult
Created by Max on 12/31/2022 in #questions
Next router is possibly undefined, leading to query with undefined input
29 replies
TTCTheo's Typesafe Cult
Created by Max on 12/31/2022 in #questions
Next router is possibly undefined, leading to query with undefined input
The API might be different for tRPC but it exists in react query
29 replies
TTCTheo's Typesafe Cult
Created by Max on 12/31/2022 in #questions
Next router is possibly undefined, leading to query with undefined input
Or you could use getServerSideProps if you wanted to go down that route
29 replies
TTCTheo's Typesafe Cult
Created by Max on 12/31/2022 in #questions
Next router is possibly undefined, leading to query with undefined input
useRouter is a hook, so it won't be available when the component first renders. You have 2 solutions: 1. Get the prop from the router then conditionally render the component with the query when it's ready, may cause issues 2. Use the enabled prop on the query so it's only enabled when the prop is ready
29 replies
TTCTheo's Typesafe Cult
Created by Yiaoma on 11/24/2022 in #questions
Is useEffect hook good place to manipulate DOM?
Personally I wouldn't approve this PR. It's not within the 'spirit' of react and the useEffect is completely unnecessary. You could just add a ternary to the input classname
17 replies
TTCTheo's Typesafe Cult
Created by noctate on 11/16/2022 in #questions
Does parsed data improve speed
The response from the network request will be slightly smaller, so you might save a couple of kb. I wouldn't do this just to save some data there. However, validating the output, specially when the data comes from an external source is generally a good idea. https://twitter.com/alexdotjs/status/1589007455295397890 You can also validate the output by using .output and putting your schema in there: https://trpc.io/docs/v9/output-validation
3 replies
TTCTheo's Typesafe Cult
Created by WOLFLEADER on 11/16/2022 in #questions
NextJS Handling binary data
I think you can just set the bodyParse to false
export const config = {
api: {
bodyParser: false,
},
}
export const config = {
api: {
bodyParser: false,
},
}
ref: https://nextjs.org/docs/api-routes/request-helpers
8 replies
TTCTheo's Typesafe Cult
Created by shikishikichangchang on 11/16/2022 in #questions
CRUD tutorial
Hey, thanks for the recommendation. CRUD is simple, it just means Create, Read, Update Delete, things most APIs should be able to do. I think what you really want to learn is REST. If you learn the principals behind REST, everything will make sense, including tRPC & GraphQL This is an oldie but a goodie to get started: https://www.youtube.com/watch?v=7YcW25PHnAA Learn HTTP methods: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods Learn HTTP status codes: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
6 replies