https://github.com/secundant/reformed
Forms is business logic
https://github.com/secundant/reformed
dx effector form forms reactive typescript ux validation
Last synced: about 2 months ago
JSON representation
Forms is business logic
- Host: GitHub
- URL: https://github.com/secundant/reformed
- Owner: secundant
- License: mit
- Created: 2023-01-12T17:10:12.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-02T19:33:44.000Z (about 2 years ago)
- Last Synced: 2025-01-16T17:54:32.178Z (3 months ago)
- Topics: dx, effector, form, forms, reactive, typescript, ux, validation
- Language: TypeScript
- Homepage:
- Size: 1.69 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Reformed
Forms as business logic.
```tsx
import { createHtmlForm } from '@reformed/html';
import { Form, useForm } from '@reformed/react';const form = createHtmlForm({
fields: {
login: [
'',
{
required: true
}
],
password: [
'',
{
required: true
}
],
comfirmPassword: [
'',
{
required: true
}
]
},
validate: {
on: 'submit',
fn: ({ password, comfirmPassword }) => {
if (password !== comfirmPassword) {
return {
comfirmPassword: 'should be equal to password'
};
}
}
},
submit: {
mapParams: omit(['comfirmPassword']),
fn: submitFx
}
});sample({
clock: form.submitFailed
});
sample({
clock: form.submitted,
target: HomePage.route.open
});// ...
function MyForm() {
const { register } = useForm(form);return (
Login
);
}
```> WIP
## Credits
Reformed inspired by ...