October 2019
Intermediate to advanced
426 pages
11h 49m
English
To be able to add new todo items, we have to connect the AddTodo component.
Let's connect the AddTodo component now:
import { inject } from 'mobx-react'
export default inject('todoStore')(function AddTodo ({ todoStore }) {
function handleAdd () { if (input) { todoStore.addTodo(input) setInput('') } }
Now, our AddTodo component will call the addTodo action from our todoStore, so we can now add new todo items!
Read now
Unlock full access