SHARE
TWEET

Untitled

a guest Apr 25th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. addTodo(todo) {
  2.   const { todos } = this.state;
  3.   const newTodo = {
  4.     id: Math.floor(Math.random() * (1000 - 1)) + 1,
  5.     todo: todo,
  6.     createdAt: Date.now(),
  7.     completed: false
  8.    };
  9.   this.setState({
  10.     todos: todos.concat(newTodo)
  11.   });
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top