devjo-ca
devjo-ca
TTCTheo's Typesafe Cult
Created by Nat on 4/15/2025 in #questions
When to use NextJS instead of just React?
A great usecase for SEO optimisation is a CMS (Content Managment System). You can look around PayloadCMS (a NextJS based CMS).
6 replies
TTCTheo's Typesafe Cult
Created by Nat on 4/15/2025 in #questions
When to use NextJS instead of just React?
That's a very interesting question! 😊 And, as always, the answer depends on the specific needs of your project. (I know that sounds a bit vague, but stay with me—I'll explain.) If your application or website relies on SEO—for example, a blog or an article-based platform—then server-side rendering (SSR) is essential. In this case, you'll want to ensure all the necessary data is rendered on the server so that crawlers can index a fully populated HTML page, instead of just seeing an empty <div id="root"></div>. If you're looking to obfuscate or protect your actual API endpoints, you can take advantage of Next.js API routes to handle server-side logic securely. Finally, if you're working on a fullstack project and need to build an API for your frontend, Next.js is still a great choice. You can either define a traditional API layer or adopt the newer React Server Components paradigm, which allows you to make direct calls to your database (for example) from within your server-side components—no separate API layer needed in some cases.
6 replies
TTCTheo's Typesafe Cult
Created by mid on 2/6/2023 in #questions
Hello
you can't use the useQuery or useMutation inside the serverSideProps. If you wan't to call trpc inside the getServerSideProps you must take a look on the ssg helper 🙂 https://trpc.io/docs/ssg-helpers#nextjs-example
4 replies
TTCTheo's Typesafe Cult
Created by MrGreyKnight on 2/3/2023 in #questions
Using clientside only library with nextjs (t3)
as Ronan told you, you can extract it to a separate component. You could leverage the dynamic import from nextjs:
import dynamic from "next/dynamic";

const ClientSideComponent = dynamic(
() => import("./client-side-component"),
{
ssr: false,
}
);
import dynamic from "next/dynamic";

const ClientSideComponent = dynamic(
() => import("./client-side-component"),
{
ssr: false,
}
);
after that you can use your component without checking if typeof window is defined
3 replies
TTCTheo's Typesafe Cult
Created by functionthatreturnsfalse on 1/14/2023 in #questions
prisma.user.create type is 'any'
did you try to restart your TS-Server ?
9 replies
TTCTheo's Typesafe Cult
Created by jakeAnon on 1/10/2023 in #questions
Correct way to get data based on email
You are defining inside the input the object:
{
text: z.string()
}
{
text: z.string()
}
So that means inside the query, you should acces throught: input.text and not input.email If input.email is a better name for you, change inside the input object you define 😉
6 replies