Jotas
Jotas
TTCTheo's Typesafe Cult
Created by deviana on 7/6/2024 in #questions
should we stop using useMemo and useCallback in react v19?
AFAIK, yes. If you notice anything weird or rerendering more than you need then you can manually fix the specific case
6 replies
TTCTheo's Typesafe Cult
Created by Palascat on 7/7/2024 in #questions
do you query the localstore everytime to get the token before making api calls ?
5 replies
TTCTheo's Typesafe Cult
Created by Palascat on 7/7/2024 in #questions
do you query the localstore everytime to get the token before making api calls ?
Localstorage is generally unsafe and a bad idea to store things like tokens, its best to use cookies, most specially httpOnly cookies (and server sessions)
5 replies
TTCTheo's Typesafe Cult
Created by nawed on 7/9/2024 in #questions
remotion media not seekable
What are you trying to do? seek a remotion video?
4 replies
TTCTheo's Typesafe Cult
Created by Jotas on 7/7/2024 in #questions
Whats the point of this ternary operator in the nextjs homepage of Create T3 App?
Thank you for the answer, i understand the Suspense stuff, however this is not my code, this is default code for the nextjs application in Create T3 App, and im confused on why it works that way considering hello will never be null/undefined
7 replies
TTCTheo's Typesafe Cult
Created by Paulo Martins on 7/7/2024 in #questions
About Theo's take of not destructuring props
you can also separate testColor and the component props with something like React.FC<{ testColor: string, inputProps: React.ComponentPropsWithoutRef<"input"> }> then <input {...props.inputProps} /> which might be the best practice for that case (you can see that pattern all arround ui packages like Material UI)
10 replies
TTCTheo's Typesafe Cult
Created by Paulo Martins on 7/7/2024 in #questions
About Theo's take of not destructuring props
And yeah, youre absolutely correct about why the error happens, casting should bypass this without having to resort to an any type.
10 replies
TTCTheo's Typesafe Cult
Created by Paulo Martins on 7/7/2024 in #questions
About Theo's take of not destructuring props
oh i see, yeah in that case destructuring is superior imo and i do it all the time lol however i believe you can just cast it if you really need to. <input {...props as React.ComponentPropsWithoutRef<"input">} />
10 replies
TTCTheo's Typesafe Cult
Created by Vap0r1ze on 7/5/2024 in #questions
Is there any React frameworks that fit my needs?
i dont recall if it works well with Suspense but ideally you would just separate every "fetch before render" logic inside your getServerSideProps, everything else would be client-side, and you would be able to just Suspend it to wait for the getServerSideProps fetch
7 replies
TTCTheo's Typesafe Cult
Created by Vap0r1ze on 7/5/2024 in #questions
Is there any React frameworks that fit my needs?
Have you tried the old pages router? maybe serverside props and incremental static regeneration will fit better your needs
7 replies
TTCTheo's Typesafe Cult
Created by Paulo Martins on 7/7/2024 in #questions
About Theo's take of not destructuring props
which throws a warning.
What warning? if you need default values "without destructuring" you can just use code before return like
export const NewComponent: React.FC<{ testColor: string } & React.ComponentPropsWithoutRef<"input">> = (props) => {
const testColor = props.testColor ?? 'red'
return (
<label>
<p style={{ background: testColor }}>Label</p>
<input {...props} />
</label>
);
};
export const NewComponent: React.FC<{ testColor: string } & React.ComponentPropsWithoutRef<"input">> = (props) => {
const testColor = props.testColor ?? 'red'
return (
<label>
<p style={{ background: testColor }}>Label</p>
<input {...props} />
</label>
);
};
10 replies