.❀ tablet ❀.
.❀ tablet ❀.
TTCTheo's Typesafe Cult
Created by .❀ tablet ❀. on 11/11/2024 in #questions
[next.js] should i cache this query?
i have a function that queries my database for a list of stories. if a user is logged in, the stories shown are automatically filtered based on categories and authors they have chosen to hide. should i cache the query results? i think that if i wrap the entire thing in unstable_cache, those query results will be shown to every user, but i'm not 100% sure.
3 replies
TTCTheo's Typesafe Cult
Created by .❀ tablet ❀. on 7/20/2024 in #questions
is manually setting props of a component returned by a render prop considered bad practice?
let's say i have this component:
function Foo(props: {renderSomething: (param: any) => VNode}) {
const rendered = props.renderSomething("hi theo");
return (<>
{rendered}
</>)
}
function Foo(props: {renderSomething: (param: any) => VNode}) {
const rendered = props.renderSomething("hi theo");
return (<>
{rendered}
</>)
}
if i were to set one of rendered's props before returning from Foo like this:
rendered.props.bar = "bazzz"
rendered.props.bar = "bazzz"
would that be considered bad practice?
12 replies