Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactderived vs stored stateSingle-choice MCQ

A table component keeps `sortColumn` and `sortDirection` in state, and also keeps a `sortedRows` array in state that it recomputes inside the click handler whenever a header is clicked. A teammate flags this as a derived-state smell. What concrete bug does storing `sortedRows` most likely cause?

const [rows, setRows] = useState(initialRows); const [sortedRows, setSortedRows] = useState(initialRows); // header click handler sorts and setSortedRows(...)