React Validate Framework is a lightweight form validation utility for React applications. It enables declaration of validation schemas and custom methods, supporting both synchronous and asynchronous validation. The library utilizes the decorator pattern via `@formConnect` to integrate validation logic into class components. It also provides a set of pre-built form components (Checkbox, Radio, Select, Text, Textarea, Message) that connect to the validation system, as well as an API for manual integration with unencapsulated components. The current stable version is 0.15.6, but the package has not been updated in approximately eight years, making it incompatible with modern React versions (17+) and development practices. Its core functionality relies on older React APIs and Babel features.
npm install react-validate-frameworkVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates a basic React class component utilizing the `@formConnect` decorator to enable form validation. It shows how to define validation `schemas` and integrate pre-built form components like `Text` and `Message` to display validation status and errors. The `handleSubmit` method triggers validation and logs form values if valid.
Consider migrating to a modern, actively maintained React form validation library. If legacy support is critical, you must use React 15 or 16 and not upgrade beyond.
Avoid using this library for new projects. For existing projects, plan for migration to a currently maintained solution to ensure long-term stability and security.
Ensure components accessing form context are updated to use the `formControl` property injected by the `@formConnect` decorator, as demonstrated in the README examples.
Configure your Babel setup (e.g., in `.babelrc` or `babel.config.js`) to include the `plugin-proposal-decorators` with the `legacy` option. For Create React App, consider using `react-app-rewired` or ejecting.
No direct fix for this library's internals. This is another reason to consider migrating to a modern library that uses current React patterns.
Verify that your Babel configuration correctly includes `@babel/plugin-proposal-decorators` (with `legacy: true`) and that the component decorated with `@formConnect` is part of a rendered tree.
Install `@babel/plugin-proposal-decorators` and add it to your Babel configuration (e.g., `.babelrc`) with `{ "legacy": true }`. Ensure the plugin order is correct if you have other plugins like `class-properties`.Downgrade your React and React DOM versions to 16.x (e.g., `npm install react@16 react-dom@16 prop-types@15`). Or, if you need React 18, replace this library with a modern alternative.
Install `regenerator-runtime` (`npm install regenerator-runtime`) and import it at the entry point of your application (`import 'regenerator-runtime/runtime';`) or configure Babel to include the necessary polyfills via `@babel/preset-env`.