Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/coderberry/formaldehyde
React form creation/validation/population. Supports top-down rendering with input population. Keeps the immutable data structures mindset.
https://github.com/coderberry/formaldehyde
Last synced: 12 days ago
JSON representation
React form creation/validation/population. Supports top-down rendering with input population. Keeps the immutable data structures mindset.
- Host: GitHub
- URL: https://github.com/coderberry/formaldehyde
- Owner: coderberry
- Created: 2016-03-09T16:01:09.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-09T16:02:33.000Z (almost 9 years ago)
- Last Synced: 2025-01-02T16:21:50.830Z (20 days ago)
- Language: JavaScript
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/inlineblock/formaldehyde.svg)](https://travis-ci.org/inlineblock/formaldehyde)
# Formaldehyde## What
React form creation/validation/population. Supports top-down rendering with input population. Keeps the immutable data structures mindset.
## Why
We needed something elegant for creating forms and inputs that self populate, require no state, and at a input AND form levels, have easy use for validation.
## How
##### Install
```bash
$ npm i formaldehyde
``````js
# CreateUserForm.js
import React from 'react';
import { Form, Input, SubmitButton } from 'formaldehyde';export default class CreateUserForm extends React.Component {
onSuccess (result) {
// if there is no action on the Form or if it returns nothing, this gets called immiediately
// otherwise if the action returns a promise, it will wait for it to finish
// the result is the result of the promise.
this.props.navigate(result.id);
}onFormValidate (model) { // this function returns an array of errors.
const errors = [];
if (!model.agree) {
errors.push('You need to agree to the terms');
}
return errors;
}render () {
return (
Create User
);
}
}
```