(8/8)
So my key takeaways are:
1. Always return new state objects
2. Think before using .push()
3. Understand event flow
4. When in doubt, console.log the event
What's your worst state mutation bug story? 👇
State Mutation & Event Propagation in React- cause me a lot of situations where I was stuck, and could not get out of it:(
Here's a thread about best practices and how you can avoid bugs!
(7/8)
Quick cheatsheet I keep handy:
1. event.stopPropagation()
- Stops bubbling up
- Use for: modals, dropdowns
2. event.preventDefault()
- Stops default browser behavior
- Use for: forms, links
Sometimes you need both!
(9/9)
Key Takeaways:
1. Patterns are solutions, not rules
2. Modern JS sometimes needs modern patterns
3. Consider maintenance & testing
4. Performance always matters
☕️ Code & Coffee Tuesday!
Let's dive into JavaScript Design Patterns - the blueprints that make our code cleaner, more maintainable, and scalable!
No fancy project today, just sticking to the basics🧵