Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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



);
}
}
```