Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

add object in array state react

const handleAdd = (todo) => {
  const newTodos = [...todos];
  newTodos.push(todo);
  setTodos(newTodos);
}
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #add #object #array #state #react
ADD COMMENT
Topic
Name
3+2 =