Skip to main content

This is a contributors guide and NOT a user guide. Please visit these docs if you are using or evaluating SuperTokens.

Move override config to separate component's prop


This is just a proposal so far, it hasn't been accepted and needs further discussion.

rishabhpoddar, porcellus
Proposed by:

Context and Problem Statement#

We may want to separate override config for components from supertokens-auth-react init, so initialization of auth-react does not depend on react. See related issue

Considered Options#

  • Separate component that takes config prop
  • Make SupertokensWrapper take config prop
  • Pass config to route handler

Decision Outcome#

Chosen option: Separate component that takes config prop, because

  • Well typed interface is very important

The new component will be called ComponentsOverrideProvider

Pros and Cons of the Options#

Separate component that takes config prop#

  • No extra code is bundled if overriding is not necessary
  • Input for config can be typed specifically for each recipe
  • Adds extra wrapper that complicates things for the user
  • Make SupertokensWrapper take config prop#

  • No need to manage extra component exposed from each recipe
  • Harder to properly type the override components for each recipe