Use toSorted() Instead of sort() for Immutability mutates the array in place, which can cause bugs with React Use to create a new sorted array without state and props. mutation. Incorrect (mutates original array): Correct (creates new array): Why this matters in React: 1. Props/state mutations break React's immutability model - React expects props and state to be treated as read-only 2. Causes stale closure bugs - Mutating arrays inside closures (callbacks, effects) can lead to unexpected behavior Browser support (fallback for older browsers): is available in all modern browsers (Chrome 110+,…