Frequently asked questions

This page is meant to be updated continually based on discussions, GitHub issues, denied PRs and any other communication with developers.

  1. How can I access the current form state directly?

    You can not - by design. When React Browser Form was designed, we tried to make it as hard and impractical as possible to violate performance recommendations - thus building a habit for developers to only ever access the form state when it is required. You can use a form with mode: "onChange" or liveFields and store the data in a local state with an onChange handler if you need access to the data outside standard event flow.

    Live fields is always the preferred way of handling form state updates - avoid using mode: "onChange" if you can due to performance concerns. See live fields usage example to understand how to access form state.

  2. Why and when should I use the built-in validation?

    This is a subjective matter. The built-in transformations and validations are designed to be simple, pure and efficient and perform a minimum amount of operations they need (like validating fields individually). The aim for these options is to allow developers to use React Browser Form to it's full extent without relying on a 3rd party while giving a simple, declarative API for basic validation.

    Keep in mind, that you can also share your validation schemas with other projects or your backend and use it in the same way. See Validation and transformation for more information on this matter.

  3. Can React Browser Form be used in React native?

    Unfortunately not. The whole point of this library is to utilize what web browsers already have implemented and it's performance is tied to document.forms. This is a design decision that is not a subject to change anytime soon.