What are keys in React, and why are they important?

Keys are unique identifiers for elements in a list. They help React identify which items have changed, been added, or removed, improving performance during re-renders.

const items = [1, 2, 3];
items.map(item => <li key={item}>{item}</li>);