The docs all show using "ensureQueryData" but that returns cached data even if it's been invalidated
I'm currently doing "fetchQuery" which accounts for invalidation but it doesn't feel right?
The docs all show using "ensureQueryData" but that returns cached data even if it's been invalidated
I'm currently doing "fetchQuery" which accounts for invalidation but it doesn't feel right?
Apparently me moving away from Next.js was all it took
I guess I'll make more videos like this
Apparently me moving away from Next.js was all it took
I guess I'll make more videos like this
Those who take this seriously right now will succeed
I built a complete roadmap on Cosden Code to teach you all the skills you need to be a successful full-stack React developer
Details below 👇
Those who take this seriously right now will succeed
I built a complete roadmap on Cosden Code to teach you all the skills you need to be a successful full-stack React developer
Details below 👇
Every day there are devs out there who see the horrendous code I wrote 8+ years ago
Every day there are devs out there who see the horrendous code I wrote 8+ years ago
Someone purchased using a discount code only sent to a few users and their email is not on that list
So someone must've given it to them
Really cool if true
Someone purchased using a discount code only sent to a few users and their email is not on that list
So someone must've given it to them
Really cool if true
Most views are existing subscribers
Which is great, but I want to reach more new viewers too
Most views are existing subscribers
Which is great, but I want to reach more new viewers too
This is mostly due to not uploading videos
I was too busy filming 129 videos for Cosden Code
Time to give YT some more attention
This is mostly due to not uploading videos
I was too busy filming 129 videos for Cosden Code
Time to give YT some more attention
That's expected and I'm not mad about it
I'm playing the long game
Time to make great YT videos again
That's expected and I'm not mad about it
I'm playing the long game
Time to make great YT videos again
I'm not looking for a fast spike. I'm playing the long game
I want Cosden code to still be relevant and successful in 5 years
I'm not looking for a fast spike. I'm playing the long game
I want Cosden code to still be relevant and successful in 5 years
That's 100+ devs taking their React success in their own hands
That's 100+ devs taking their React success in their own hands
The videos are SO GOOD. Literally my best work
First course is on design patterns in React, and I promise you, you haven't seen most of these patterns
I'm beyond excited to launch this
The videos are SO GOOD. Literally my best work
First course is on design patterns in React, and I promise you, you haven't seen most of these patterns
I'm beyond excited to launch this
This means that the JSX is not going to get updated in that render
React is going to start again on a new render from the top
This means that the JSX is not going to get updated in that render
React is going to start again on a new render from the top
This is when you call a state updater function directly in the body of the component as its rendering
React will abandon the render and start again with a new value
Here's an example
This is when you call a state updater function directly in the body of the component as its rendering
React will abandon the render and start again with a new value
Here's an example
We can create an effect event called onVisit and call that in the body of useEffect instead
Effect events do not need to be provided in dependency arrays, but they still see the latest values
We can create an effect event called onVisit and call that in the body of useEffect instead
Effect events do not need to be provided in dependency arrays, but they still see the latest values
The rules of hooks say that everything used inside of the body of useEffect has to go in the dependency array
So if we can't do that, what's the solution?
The rules of hooks say that everything used inside of the body of useEffect has to go in the dependency array
So if we can't do that, what's the solution?
With this code, when the numberOfItems changes, the event will fire even if the URL hasn't changed
This is probably not what we want
To fix it, we need to remove numberOfItems from the deps array
With this code, when the numberOfItems changes, the event will fire even if the URL hasn't changed
This is probably not what we want
To fix it, we need to remove numberOfItems from the deps array
The beauty of this pattern is flexibility. Your function is still reusable and shared, but you control the behavior everywhere you use it
With this, I've been able to do anything in my apps
The beauty of this pattern is flexibility. Your function is still reusable and shared, but you control the behavior everywhere you use it
With this, I've been able to do anything in my apps
With this, you're free to now handle the result of the function in any way that you want
Want to return JSX on error? Sure. Want to send to sentry? Sure
It's completely flexible
With this, you're free to now handle the result of the function in any way that you want
Want to return JSX on error? Sure. Want to send to sentry? Sure
It's completely flexible
I have come to avoid using try catch in my code and heavily rely on this small utility function
I have come to avoid using try catch in my code and heavily rely on this small utility function
It doesn't matter what it does, just that it has some reusable logic that you need
The key here however, is that the function does not handle any errors (if the db call fails, it will throw)
It doesn't matter what it does, just that it has some reusable logic that you need
The key here however, is that the function does not handle any errors (if the db call fails, it will throw)
It gives you all of the benefits of a reusable function, while keeping the flexibility of how you might use it
Here's the code:
It gives you all of the benefits of a reusable function, while keeping the flexibility of how you might use it
Here's the code:
That's what refs do. They allow you to store values and keep them for the lifetime of the component
So in this case, the console log will log the incremented value when the component renders
That's what refs do. They allow you to store values and keep them for the lifetime of the component
So in this case, the console log will log the incremented value when the component renders
Normal JS variables don't hold their value across renders, so even if you increment it, on the next render, it will be reset to 0
This is because the variable is being created and initialized in the component
Normal JS variables don't hold their value across renders, so even if you increment it, on the next render, it will be reset to 0
This is because the variable is being created and initialized in the component
A lot of developers don't know this fundamental difference
Here's what's different and why you want to use a ref most of the time
A lot of developers don't know this fundamental difference
Here's what's different and why you want to use a ref most of the time