Quiz Engine — A useReducer State Machine for Quiz Funnels

The quiz engine is the brain of quiz-ui: a useReducer-based state machine that lives inside QuizProvider. It manages the current step, the answer map, the visit history, and the funnel status. Components read from it via hooks — useQuizStep, useQuizAnswers, useQuizEngine — and never touch the state directly.

Last updated: 2026-09-25

Frequently asked questions

  • Can I use the quiz engine without the styled components?

    Yes. quiz-core is a headless package — install it independently and build your own components on top of the engine hooks.

  • What actions does the engine support?

    ANSWER (record an answer), ADVANCE (go to next step, resolving branches), BACK (go to previous step in history), GO_TO (jump to a specific step), and RESET (start over).

  • Is the engine tested?

    The engine is a pure function (reducer) — test it with any test runner by calling createQuizReducer with your definition.