更新时间:2021-08-05 10:34:51
封面
Title Page
Copyright and Credits
MobX Quick Start Guide
Dedication
Packt Upsell
Why subscribe?
PacktPub.com
Foreword
Contributors
About the authors
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Code in Action
Conventions used
Get in touch
Reviews
Introduction to State Management
The client state
Handling changes in state
The side effect model
A speed tour of MobX
An observable state
Observing the state changes
It's time to take action
A comparison with Redux
Redux in a nutshell
MobX versus Redux
Summary
Observables Actions and Reactions
Technical requirements
Observables
Creating observables
Observable arrays
Observable maps
A note on observability
The computed observable
Better syntax with decorators
Actions
Enforcing the use of actions
Decorating actions
Reactions
autorun()
reaction()
A reactive UI
when()
when() with a promise
Quick recap on reactions
A React App with MobX
The book search
Observable state and actions
Managing the async action
The Reactive UI
Getting to the store
The SearchTextField component
The ResultsList component
Crafting the Observable Tree
The shape of data
Controlling observability
Using @decorators
Creating shallow observables with @observable.shallow
Creating reference-only observables with @observable.ref
Creating structural observables with @observable.struct
Using the decorate() API
Decorating with observable()
Extending the observability
Derived state with @computed
Structural equality
Modeling the stores
Observable state
Derived state
Derivations Actions and Reactions
Derivations (computed properties)
Is it a side effect?
There's more to computed()
Error handling inside computed
Why an action?
Async actions
Wrapping with runInAction()
flow()
Configuring autorun() and reaction()
Options for autorun()
Options for reaction()
When does MobX react?
The rules