Skip to content

Releases: moubi/enform

Subsequent form value updates

06 Oct 08:59
Compare
Choose a tag to compare

It's now possible to have several onChange() calls that update form values without skipping or erasing.

<input
  type="text"
  value={values.field1}
  name="field1"
  onChange={e => {
    onChange("field1", e.target.value);
    onChange("field2", e.target.value);
  }}
/>

The above snippet will change both field values successfully.

Drop IE11 (with core-js) support

03 Oct 09:01
Compare
Choose a tag to compare

Drop IE11 support in babel.config.js. This change no longer require core-js to be present in the consumer project as a polyfil fallback.

Introduce useEnform() hook

18 Aug 11:13
Compare
Choose a tag to compare
  • <Enform /> now uses the useEnform hook internally.
  • useEnform exposes the same API as the render props component.
  • can be used like so:
import { useEnform } from "enform";
const { values, errors, ... } = useEnform(initialValuesObject, validationObject);
  • no breaking changes
  • no changes in the bundle size

Add IE11 support

24 Jun 12:32
Compare
Choose a tag to compare
  1. Add IE11 support
  2. update babel config with the following
  • ensure polyfills are loaded just once
  • transpile modules to commonjs in tests

Default passing validation to false

02 Jun 19:20
Compare
Choose a tag to compare

If field value is passing its validation the errors object for that field will always default to false. With that in place it is no longer required for validator functions to return falsy value. The should only return error message or true.

#18

Cache internal functions with useCallback

02 Jun 19:23
Compare
Choose a tag to compare

Introduce useCallback to cache functions exposed by Enform.

Set errors programmatically

13 May 09:12
Compare
Choose a tag to compare
  • ✅ create setErrors() function to allow setting errors from outside Enfrom.
    This feature should cover use cases where errors need to be set as a result on non user input. Fx. calling an API that returns field specific error.
  • 🔨 Do not call setErrors() internally if error is not present for a field when using onChange().

Deep compare initial values using sort and JSON.stringify

07 May 07:35
Compare
Choose a tag to compare

Check for changes in the initial prop using JSON.stringify and key sorting 😮That guarantees high chance of success without introducing external dependencies.

Handle re-render when initial prop changes

06 May 09:45
Compare
Choose a tag to compare

Enform will now re-render when initial prop updates ✅ That is done using ref comparison, so a new object should be passed down to Enform in order to make it update its state.

Remove react and react-dom from dependencies

01 May 15:16
Compare
Choose a tag to compare

They are now moved to devDependencies and "react": ">= 16.8.0" (hooks ↪️) goes to peerDependencies.

As a consequence the package bundle should be smaller.