I'm having a problem with pagination. When I navigate to another page, I wanna set "page" back to "1" but nothing happen, my data is not update
@igdev60952 жыл бұрын
I think ['products', 1] is still in my cache so it doesn't do anything like re-fetch new data
@MrZiyak993 жыл бұрын
Loving this series so far! Do you think a combination of react query and react context eliminates the need for more powerful state management tools like redux? I usually default to redux for projects but was thinking of giving react query + context a try.
@CodeDunks3 жыл бұрын
Thanks Ziyak! I think it depends on the use case and your personal preference. If you are using redux only to avoid props drilling, then yes I believe you can replace it. I usually see it like this, 1. If your project is a small project without a lot of state changes, then use context api 2. If your project plans on being a large application with a lot of state updates use redux. The reason for that is that redux only re-renders updated components, while context api will re-render all components regardless. This might have changed in react 17 or 18 so I am not sure but that's how I used to think about it.
@MrZiyak993 жыл бұрын
@@CodeDunks Yeah makes sense. With redux I am inclined towards RTK Query over React Query. I feel like React Query would make a better pair with Context whilst RTK Query works better with redux. At this point tho I've seen too many of your React Query videos to not give it a try so I will surely check it out ✌️
@CodeDunks3 жыл бұрын
@@MrZiyak99 Oh nice, I haven't had the chance to work with RTK Query but seems cool. I would say try it out for sure, I have been loving the dev experience with it.
@sreekumarmenon3 жыл бұрын
In my current project, i use React Query with Context. very powerful !
@venicebeachsurfer2 жыл бұрын
A little off topic, but why create a new file for every Interface - that seems excessive.. why not just have one file, ala "Pagination.types.ts" or "Schemas.types.ts" etc.... ?
@Kuzkonic3 жыл бұрын
Hey Leo im having problems with the optional chaining part. When i start the app i get this error TypeError: Cannot read property 'map' of undefined {data?.pages.map((page) => .... ^ I used your tsconfig but im still having this error
@CodeDunks3 жыл бұрын
It seems that the pages object returned from data is undefined.