Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update application section of readmme #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,19 @@ The id of the new TodoEntry is the current maximum id + 1. The text is taken fro
The launcher [TodoMVC][class todomvc] is the last part of the example. As usual in JavaFX, we extend the Application class. To start a ReduxFX application, we need to define the initial state. In our case it has an empty newTodoText, zero todo-items, and the filter is set to show all entries. Next we need to call ReduxFX.start with the initial state, the updater-function, the view-function, and the stage where the SceneGraph should be shown.

```
public class Launcher extends Application {
public class TodoMVC extends Application {

@Override
public void start(Stage primaryStage) throws Exception {

final AppModel initialState = new AppModel("", Array.empty(), Filter.ALL);
// Setup the initial state
final AppState initialState = AppState.create();

ReduxFX.start(initialState, Todos::update, MainView::view, primaryStage);
// Setup the ReduxFX-store passing the initialState and the update-function
final ReduxFXStore<AppState> store = new ReduxFXStore<>(initialState, Updater::update, new LoggingMiddleware<>());

primaryStage.setTitle("TodoMVCFX - ReduxFX");
primaryStage.show();
// Setup the ReduxFX-view passing the store, the view-function and the primary stage that should hold the calculated view
ReduxFXView.createStage(store, MainView::view, primaryStage);
}

public static void main(String[] args) {
Expand Down