1 Reply
Hi! Take a look to the documentation: https://react.dev/learn/updating-arrays-in-state#
Yeah, you can "add" a Components to an array. I guess your trying to render an array of elements and you're using
useState
for it. Basically, you don't want to use push
or another mutating method. The "react way" is to create a new array and use it to update your state.Updating Arrays in State – React
The library for web and native user interfaces