2.2.0 • Published 2 years ago

fielder v2.2.0

Weekly downloads
200
License
MIT
Repository
github
Last release
2 years ago

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:

2.2.0

2 years ago

2.2.0-beta.0

3 years ago

2.1.1-beta.0

3 years ago

2.1.1

3 years ago

2.1.0

4 years ago

2.1.0-beta.1

4 years ago

2.1.0-beta.0

4 years ago

2.0.0

4 years ago

2.0.0-beta.1

4 years ago

2.0.0-beta.0

4 years ago

1.3.1

4 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.0

5 years ago