𝗙𝗹𝗮𝘁𝘁𝗲𝗻 𝗡𝗲𝘀𝘁𝗲𝗱 𝗔𝗿𝗿𝗮𝘆𝘀 𝗶𝗻 𝗝𝗮𝘃𝗮𝗦𝗰𝗿𝗶𝗽𝘁 Nested arrays happen often. You get them in API responses. You see them in tree structures. Flattening turns these into a single list ...
Your original stays safe. React needs new arrays for state. Do not mutate state. Replace state with a new array. Use setTodos ( [ ...todos, newTodo ]). Remember these points: - Const does not mean ...