Slide 43
Slide 43 text
CrEAtE SaVE Flow
Component
handles submit,
create action
Api Helper
calls api
,success action
Action
dispatches
Store
saves data/flag,
emits change
Component
gets store data,
renders,
transitions
1 componentDidMount() {
2 BooksCreateStore.addChangeListener(this._onChange)
3 },
4
5 _onChange() {
6 this.setState(this.getStateFromStores(), () => {
7 if (BooksCreateStore.isCreated()) {
8 Router.transitionTo('books-show', { id: this.state.book.id })
9 }
10 })
11 },
Action
calls api helper