Skip to content

Convert Form elements to be Controlled components #3

@realStandal

Description

@realStandal

React promotes the use of Controlled components. This let's React play its helpful role as the source-of-truth. Components that make use of <Form> elements should use React-state to control the value of the form's inputs. The form submit functionality should similarly be controlled from the scope of React; bypassing the browser's default functionality.

The Kratos SDK should be used to simulate the submitted. Its completeRegistrationForPasswordMethod (or similar) functions should be used to send the request used to validate the user's credentials. Where the following arguments correlate with:

  • flow the user's flowId as returned through the URL query.
  • payload the user's credentials, entered in form inputs stored in React's state.
  • options configuration to indicate to Kratos that the request originated in a browser.
    • headers.Content-Type = application/x-www-form-urlencoded

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions