React native quiz app design approach?


#1

Hello Everyone,

I am building a quiz game with react native, and i am trying to figure out a better solution then the one i have build right now.

the game consist of 7 levels, each level has 10 questions, that makes total of 70 question; Each question has 4 possible response and only one correct

I have everything coded but the solution is dump and causing the setState to act oddly.

in case you are wondering this is my approach : https://gist.github.com/oflarcade/781a79bf584b45dcf2c3f7dd952e333d

which question will be displayed on the screen is dependent on the levelSelected variable and the questionSelected variable,

I have two functions that will handle that:

_loadQuestionData() : contains a switch statement for each level.

_firstLevel() : contains a switch statement for 10 cases

this really a stupid approach?

Design thinking wise can one suggest another approach ?

As you can see from the gist, i still didn’t figure out redux, so i am relying heavily on state and AsyncStorage, and for the time been i would like to continue if possible in this approach.

Thank you in advance.


closed #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.