brunoeduardodev
brunoeduardodev
TTCTheo's Typesafe Cult
Created by Pranoy on 6/17/2023 in #questions
Mern stack Or Nextjs ?
I still think using vite is like using cra, you’re using a bundler but you don’t need to care about it
28 replies
TTCTheo's Typesafe Cult
Created by Pranoy on 6/17/2023 in #questions
Mern stack Or Nextjs ?
using MERN with vite, which is what’s recommended and you still won’t need to learn bundling
28 replies
TTCTheo's Typesafe Cult
Created by Pranoy on 6/17/2023 in #questions
Mern stack Or Nextjs ?
initially I thought the focus were only mastering react, so in that case going with nextjs solely would be better
28 replies
TTCTheo's Typesafe Cult
Created by Pranoy on 6/17/2023 in #questions
Mern stack Or Nextjs ?
in this case you can go with MERN using nextjs on the react side, so you can improve both on nodejs and react
28 replies
TTCTheo's Typesafe Cult
Created by Pranoy on 6/17/2023 in #questions
Mern stack Or Nextjs ?
but if you want to go really deep, eventually you can even setup your own node server with ssr, server components, etc
28 replies
TTCTheo's Typesafe Cult
Created by Pranoy on 6/17/2023 in #questions
Mern stack Or Nextjs ?
currently NextJS is the framework with the best integration with server components, and right now server components, and server actions coming soon, are becoming a big part of react, so if you want to master it, it makes sense to a framework where you can apply it's concepts
28 replies
TTCTheo's Typesafe Cult
Created by Pranoy on 6/17/2023 in #questions
Mern stack Or Nextjs ?
NextJS
28 replies
TTCTheo's Typesafe Cult
Created by Pranoy on 6/17/2023 in #questions
Mern stack Or Nextjs ?
if you're mostly talking about having a standalone server vs using api routes, I think it depends on how much complexity your backend needs and if your project is able to run in a serverless environment
28 replies
TTCTheo's Typesafe Cult
Created by akerbeltz on 6/14/2023 in #questions
Union types to solve magic strings problems
I found union types usually less annoying and less "boilerplate-like"
5 replies
TTCTheo's Typesafe Cult
Created by ARLISS on 6/9/2023 in #questions
alternative to getServerSideProps() for /app router era?
1. if you're talking about when opting for the app router, it's because with server components you have a ´nicer´ api 2. the page component on each route, if you need querying should be an async server component, you can just fetch the data through Fetch API or directly querying it through the database, using prisma/drizzle for example, in order to have the getServerSideProps behavio (no-cache), you can: if you're using the Fetch API, just use
fetch('your-endpoint', { cache: 'no-store' });
fetch('your-endpoint', { cache: 'no-store' });
if you're not using Fetch API, just add to page.tsx:
export const revalidate = 0;
export const revalidate = 0;
All this info is available here: https://nextjs.org/docs/app/building-your-application/data-fetching/fetching 2.1 since the results came from the server, you shouldn't need push to them into local storage, just save the search in a state, and then calculate the filtered items at rendering, like this: https://react.dev/learn/thinking-in-react
3 replies
TTCTheo's Typesafe Cult
Created by bedesqui on 6/8/2023 in #questions
Running before unmount on server components??
ah, just got the leaf ideia, it's actually way better
14 replies
TTCTheo's Typesafe Cult
Created by KiKo on 6/8/2023 in #questions
Revalidate using App Dir tRPC
This is looking so cool! 👀
8 replies
TTCTheo's Typesafe Cult
Created by bedesqui on 6/8/2023 in #questions
Running before unmount on server components??
using wrapper components seems to work btw
14 replies
TTCTheo's Typesafe Cult
Created by bedesqui on 6/8/2023 in #questions
Running before unmount on server components??
14 replies
TTCTheo's Typesafe Cult
Created by bedesqui on 6/8/2023 in #questions
Running before unmount on server components??
or maybe as Igor said, this might be writteable as a hoc
14 replies
TTCTheo's Typesafe Cult
Created by bedesqui on 6/8/2023 in #questions
Running before unmount on server components??
// UnmountAware
type Props = {
children: ReactNode
onUnmount: () => void;
}

export const UnmountAware = ({children, onUnmount}: Props) => {
useEffect(() => {
return onUnmoun
}, [onUnmount])

return children;
}
// UnmountAware
type Props = {
children: ReactNode
onUnmount: () => void;
}

export const UnmountAware = ({children, onUnmount}: Props) => {
useEffect(() => {
return onUnmoun
}, [onUnmount])

return children;
}
14 replies
TTCTheo's Typesafe Cult
Created by bedesqui on 6/8/2023 in #questions
Running before unmount on server components??
this looks like just a server component wrapped to a client component with an effect cleanup
14 replies
TTCTheo's Typesafe Cult
Created by wlvz on 6/7/2023 in #questions
prisma nested writes / updates not working
just read the "name" that you're sending on the post request through the body also notice that with the current UI you're only getting 1 name at a time
8 replies
TTCTheo's Typesafe Cult
Created by wlvz on 6/7/2023 in #questions
prisma nested writes / updates not working
you would see that the way you're running findUnique would be wrong if you didn't used the "as SubjectsWhereUniqueInput"
8 replies