Open farishkash opened 6 years ago
https://github.com/DarryllRobinson/jammming/blob/1f59ed342bf0476b0c318db8398957f236f45657/src/components/App/App.js#L44
https://github.com/DarryllRobinson/jammming/blob/1f59ed342bf0476b0c318db8398957f236f45657/src/components/App/App.js#L53
What you are doing here is called state mutation(changing the value of state directly), you are never supposed to do that with React.
Take a look at this article as it gives a good reason why based on the React documentation plus some examples of how to setState properly.
https://medium.freecodecamp.org/handling-state-in-react-four-immutable-approaches-to-consider-d1f5c00249d5
https://github.com/DarryllRobinson/jammming/blob/1f59ed342bf0476b0c318db8398957f236f45657/src/components/App/App.js#L44
https://github.com/DarryllRobinson/jammming/blob/1f59ed342bf0476b0c318db8398957f236f45657/src/components/App/App.js#L53
What you are doing here is called state mutation(changing the value of state directly), you are never supposed to do that with React.
Take a look at this article as it gives a good reason why based on the React documentation plus some examples of how to setState properly.
https://medium.freecodecamp.org/handling-state-in-react-four-immutable-approaches-to-consider-d1f5c00249d5