.data(TodoActions.KEY_TEXT, todo)); } public void clear() { Dispatcher.dispatch(Action.with(TodoActions.TYPE_CLEAR)); } } public class TodoActions { public static final String TYPE_CREATE = "CREATE"; public static final String TYPE_CLEAR = "CLEAR"; public static final String KEY_TEXT = “KEY_TEXT"; } ActionCreator
.data(TodoActions.KEY_TEXT, todo)); } public void clear() { Dispatcher.dispatch(Action.with(TodoActions.TYPE_CLEAR)); } } public class TodoActions { public static final String TYPE_CREATE = "CREATE"; public static final String TYPE_CLEAR = "CLEAR"; public static final String KEY_TEXT = “KEY_TEXT"; } ActionCreator Action ࢤࢿ ߂ Dispatch
in Store Mutable State Action ݺद Dispatcher হ Single Store Business logic in Reducer Immutable State MVI Action হ Dispatcher হ Multiple Store(Presenter) Business logic in Reducer Immutable State
private TodoStore store = TodoStore.get(); public void create(String text) { Todo todo = repository.create(text); store.create(todo); } public void clear() { repository.clear(); store.clear(); } } Presenter