October 2019
Intermediate to advanced
426 pages
11h 49m
English
In addition to providing global stores to store application-wide state, MobX also provides local stores to store local state. To create a local store, we can use the useLocalStore Hook.
We are now going to implement the Local Store Hook in the AddTodo component:
import { useLocalStore, useObserver } from 'mobx-react'
const [ input, setInput ] = useState('')
Replace it with a Local Store Hook:
const inputStore = useLocalStore(() => ({
In this local store, we can define state values, computed values, and actions. The useLocalStore Hook will automatically decorate values ...
Read now
Unlock full access