Timeline for Pattern usage for increment / decrement React (Hooks)
Current License: CC BY-SA 4.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 7, 2020 at 7:07 | comment | added | BCdotWEB | The current question title of your question is too generic to be helpful. Please edit to the site standard, which is for the title to simply state the task accomplished by the code. Please see How do I ask a good question?. | |
Aug 6, 2020 at 21:51 | vote | accept | Juan Marco | ||
Aug 5, 2020 at 2:12 | answer | added | Drew Reese | timeline score: 3 | |
Aug 4, 2020 at 2:01 | comment | added | Jayce444 | @JuanMarco spread only makes a shallow copy. Only works if the array is composed entirely of primitives like strings, numbers or booleans. You have an array of objects, so it won't do a deep copy. | |
Aug 3, 2020 at 12:17 | comment | added | adiga | @JuanMarco spread syntax creates a copy of the array. The objects inside it are still the same in the copy and the original array. | |
Aug 3, 2020 at 12:16 | comment | added | Juan Marco | I'm not mutating the state @adiga, I'm making a copy of the state using spread syntax. I then make the change and update the state. See here for details. | |
Aug 3, 2020 at 6:39 | comment | added | adiga |
currentItems[index].quantity += 1 mutates the state. const currentItems = [...stock] only creates a shallow copy of the array.
|
|
Aug 2, 2020 at 21:09 | history | edited | Juan Marco | CC BY-SA 4.0 |
fix minor bug
|
Aug 2, 2020 at 20:47 | comment | added | pacmaninbw♦ | Please see our guidelines for future reference. Especially any part about context. | |
Aug 2, 2020 at 20:17 | comment | added | Juan Marco | The functioning snippet is under "Show code snippet" @pacmaninbw | |
Aug 2, 2020 at 20:06 | comment | added | pacmaninbw♦ | Welcome to Code Review, where we review working code and provide suggestions on how that code can be improved. This question without the functioning snippet is off-topic.Rather than hiding the snippet I would leave it fully open all the time. | |
Aug 2, 2020 at 18:25 | review | First posts | |||
Aug 2, 2020 at 20:06 | |||||
Aug 2, 2020 at 18:23 | history | asked | Juan Marco | CC BY-SA 4.0 |