Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace <Form /> input with generic field factory #150

Merged
merged 4 commits into from
Aug 11, 2018

Conversation

TrySound
Copy link
Collaborator

In this diff I added <Form /> generic field factory as
a replacement for input factory. The main difference is each
value can have now any type, not only strings like before.

The second change is more generic onChange method which accepts
either value, or event like object which has this structure

{
  target: {
    value: T
  }
}

This allows to work with components which emulates their event and
produces not string type.

`<State />` component has too much own logic which makes `State` based
components more complex with additional `set` and `onChangeProp`
helpers.

In this diff I reimplemented `<Value />` as class and `<State />` and
another components as `Value` based.

This reduced bundle size with ~0.8kb (parsed) and significantly
simplified components implementation.
In this diff I added `<Form />` generic `field` factory as
a replacement for `input` factory. The main difference is each
value can have now any type, not only strings like before.

The second change is more generic `onChange` method which accepts
either value, or event like object which has this structure

```js
{
  target: {
    value: T
  }
}
```

This allows to work with components which emulates their event and
produces not string type.
@TrySound TrySound changed the title Replace <Form /> input with generic field factory Replace <Form /> input with generic field factory Aug 10, 2018
@TrySound TrySound changed the base branch from value-base-component to master August 10, 2018 22:01
@TrySound TrySound merged commit 4cfb56f into master Aug 11, 2018
@TrySound TrySound deleted the generic-form-field branch August 11, 2018 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants