New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fielder

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fielder

A field-first form library for React and React Native

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
223
decreased by-2.62%
Maintainers
1
Weekly downloads
 
Created
Source

Fielder logo

Fielder

A field-first form library for React and React Native.

build version size coverage docs

About

Fielder is a form library for React and React Native that has been built from the ground up with a field-first approach to validation.

Features

⚡️ Synchronous validation - no cascading renders

🛎 Validation events - validation can differ per event (change, blur, submit, etc.)

🪝 Hooks that work - hooks respond to validation changes

🧠 Evolving schemas - validation logic evolves with the UI

Basic usage

Install Fielder

Add Fielder to your project.

npm i fielder

Import the module

Use fielder or fielder/preact.

// React
import { useForm, ... } from 'fielder';

// Preact
import { useForm, ... } from 'fielder/preact';

Set up a form

Use the useForm hook to create a form.

const myForm = useForm();

return <FielderProvider value={myForm}>{children}</FielderProvider>;

Create some fields

Use the useField hook to create a field.

const [usernameProps, usernameMeta] = useField({
  name: 'username',
  initialValue: '',
  validate: useCallback(({ value }) => {
    if (!value) {
      throw Error('Username is required!');
    }
  }, []),
});

return (
  <>
    <input type="text" {...usernameProps} />
    <span>{usernameMeta.error}</span>
  </>
);

Additional info

Once you're all set up, be sure to check out the guides for a deeper dive!

Additional resources

For more info, tutorials and examples, visit the official docs site!

Also check out:

Keywords

FAQs

Package last updated on 12 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc