Programming › Re: Why Are Naija "Learn To Code People" Like This by qtguru(m): 8:19pm On Jan 20, 2023 |
They could be freelancers. |
Programming › Re: Algorithm Study Plan by qtguru(op): 12:41pm On Jan 20, 2023 |
deraCoder: Thanks… Don't have to study all…you can learn the ones that are applicable to what you are doing as a dev Agreed most might not be needed until you get to that stage. |
Programming › Re: Algorithm Study Plan by qtguru(op): 7:54pm On Jan 19, 2023 |
OlawaleBammie: Baba good evening sir
Pls I need an advice from u.
I just started learning software development sir, and my aim is this.. By the end of my study I want to move abroad (Canada) on a study route(degree in software engineering as well), pls is it possible for me to get an internship program over there while I study?? I can't say for sure, when I asked someone; their answer was yes, I guess it depends on the province |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 4:58pm On Jan 19, 2023 |
Devdevdev: The videos is enough. Thank you so much You have a nice voice. Appreciate  |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 4:11pm On Jan 19, 2023 |
@devdevdev how do I send the code, or is the video enough ? |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 3:46pm On Jan 19, 2023 |
truthCoder2: Please what OS are you using?
I can see Mac OS-like buttons and a windows-lke tray KUbuntu KDE Plasma but i downloaded a style called breeze, it has that mac-os feel |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 3:27pm On Jan 19, 2023 |
|
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 3:14pm On Jan 19, 2023 |
Fixed recording video to explain now |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 3:06pm On Jan 19, 2023 |
I don't understand the logic behind your code,
If you want to add to Cart, why not create an empty array, and only add when a payload matches, I will do it and share a video soon. |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 2:58pm On Jan 19, 2023 |
truthCoder: cartItem.amount was undefined because it was not existing at initial state.
It was not existent because cartItems didn’t have an amount parameter in the objects.
You also called {amount} instead of {product.amount}. This was rightly pointed out by GIM above.
Defining amount in your objects would remove the need for ||0 Yeah that's right it's undefined |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 2:37pm On Jan 19, 2023 |
WIP |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 2:36pm On Jan 19, 2023 |
@devdevdev
I noticed I made some mistake in my comments, I used combinedReducer, you used createSlice, createSlice handle the type and action on it's on, so the name + reducer function is triggered, look the screenshot your code works.
The payload is logged to the console, so the next part is to experiment with the Cart component and see if it reflects there
|
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 1:45pm On Jan 19, 2023 |
|
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 1:43pm On Jan 19, 2023 |
Did you push it to Github ? this can be solved faster if shared. |
Programming › Re: Algorithm Study Plan by qtguru(op): 1:32pm On Jan 19, 2023 |
sqlPAIN: if you really want to expand your knowledge or study computer science as you said,then take jamb this year,enter school and go get a CS degree. Stop deceiving ya sef oga  No comment |
Programming › Re: Algorithm Study Plan by qtguru(op): 10:43am On Jan 19, 2023 |
sqlPAIN: All these just to get a high paying job abi?  No it's about studying Computer Science, if you are interested in expanding your knowledge |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 6:41am On Jan 19, 2023*. Modified: 7:49am On Jan 19, 2023 |
truthCoder: Share the code repository
GitHub was invented for this reason. Exactly taking too much time to fix a bug like this, we could have ironed it out with github. |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 5:58am On Jan 19, 2023 |
Devdevdev: Sent This won't work, I don't have the package.json, you were supposed to send the whole project so I can install the modules and run on my end. |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 10:20pm On Jan 18, 2023 |
Devdevdev: @GreatIgboMan, do you have an email address? I'll mail the code to you and qtguru now. OKEOWOADEREMI AT GMAIL DOT COM |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 10:14pm On Jan 18, 2023 |
Devdevdev: I tried implementing your instruction. Still didn't work. Put a debugger and see if you reach the reducer, send the project to my mail, let me run it and fix. coding by looking at image is long thing. |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:34pm On Jan 18, 2023 |
Your code is wrong. Fix those issues I pointed out, A reducer should always return a new state always |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:33pm On Jan 18, 2023 |
2. your dispatch is meant to take an object , you also didn't change that too |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:33pm On Jan 18, 2023 |
Devdevdev: I already did. Still same issue. 1. You didn't refactor the reducer to return a new state |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:24pm On Jan 18, 2023 |
Get rid of the Context, you're already using Redux Hooks, you don't need it. Just use only Redux, let each component query the reducer it needs. |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:18pm On Jan 18, 2023 |
[quote author=Devdevdev post=120165256][/quote]You are using useDispatch wrong, because your code won't know which reducer to call I think
|
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:15pm On Jan 18, 2023 |
Do this in your reducer. e.g return {...state, {amount: action.payload | value }} something like that |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:14pm On Jan 18, 2023 |
The value return becomes the new state, and triggers every component listening to that, allowing them to receive the new copy. Try my suggestion. |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:12pm On Jan 18, 2023 |
When you call a Dispatcher, it uses the type to know which reducer to call, it expects a return value, but you are doing a side-effect instead of returning something like this e.g {...state,newProps} |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:10pm On Jan 18, 2023 |
This is how the Dispatch is, it requires a type, also the point of the reducer is to return a new object combined from previous state and new update. What you're doing is an impure function. Look at this code i uploaded.
|
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:01pm On Jan 18, 2023 |
also the item.id === payload what is that logic ? |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 9:01pm On Jan 18, 2023 |
Devdevdev: I switched to redux tool kit and I am still having the same issue. The clearCart and removeItem functionality are working just fine. It's just the addOne that isn't. I think the issue is with the 'amount' variable and how it's state is getting altered. I am seriously confused. want to jump on google meeting, it's hard to debug on image |
Programming › Re: Please I Need Help With This Reactjs Issue - Context Api & RTK (pictures) by qtguru(m): 5:14pm On Jan 18, 2023 |
@devdevdev |