function handleBlur(event) {
if (event.target.value !== props.value) {
// a hook function that ends up rerendering the whole playlist
}
}
i'm experimenting with React hooks and i have a playlist that holds a bunch of components that have input textboxes. modifying an item in the list unfortunately seems to render the whole playlist component despite memoizing so I'm trying to move the save playlist function to onBlur instead of onChange. but when I'm on a textbox and I tab over, once the re-render happens I lose the tab focus of the textbox I'm on. Is there any way I can prevent this? Any tips on how to prevent rerendering the whole playlist when i want to modify just an object in a list would be nice as well
playerList.map((player, index) => (
<DraftPlayer
arrayPosition={index}
key={index + (Math.random()).toString()}
modifyPlayer={modifyPlayer} //hook function
player={player}
/>
))
const [playerList, setPlayerList] = React.useState(
initializePlayerListArray([ { firstName: "", lastName: "" },{ firstName: "", lastName: "" },{ firstName: "", lastName: "" },{ firstName: "", lastName: "" },{ firstName: "", lastName: "" },etc ])
);