I am new to React, NodeJS, Newforms, and Spray. Currently we are working on a simple application involving 30 screens(pages) and each page has one question. Depending the answer given in each page, either the user journey ends or moves to the next question. We need help in coming up with page navigation technique.

Couple of approaches come to my mind are :

Centralised Navigation approach: Have a central navigation logic with configuration for each question. For each question, the possible answers and next course of action(terminate the user journey or display the next question) is built into this. After each page is submitted, fill the main JSON data model. Depending on the last question answered, decide the next course of action.

Distributed navigation approach: Each page action knows the navigation logic

I am curious which one is best and how to further design it. Are there any other standard approaches the are best suited for such applications.

1

There are 1 answers

0
Colin Ramsay On

Sounds like you might want to look into Flux. You could have a navigation store which each component can use to determine the state of the application.

An alternative would be to have a top-level "navigation wrapper" component that deals with the logic, then each question could be a child of that. I still think you could benefit from a flux implementation there though.