Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

React

Ben Ja
PLUS
Ben Ja
Courses Plus Student 6,055 Points

explaining useState() re-rendering so that we are using useRef

guys, you would have better explained why we use useRef, it's because useState() is using onChange event handler in input field and that's causing unnecessary renders with each interaction with that respective input element. like typing letters, pressing backspace. so that is causing memory leaks because we don't need that re-rendering with each interaction. we just need to add player in our list. so we use useRef.