๐ React Hooks for form state management and validation (Web + React Native)
MIT License
Bot releases are visible (Hide)
Published by bluebill1049 over 2 years ago
๐๐ป improve build dist package size (https://github.com/react-hook-form/react-hook-form/pull/8511)
๐ fix https://github.com/react-hook-form/react-hook-form/issues/8506 delayError
not overwrite existing function call (https://github.com/react-hook-form/react-hook-form/pull/8509)
๐ update the use of validadtionSchema in v7 examples (https://github.com/react-hook-form/react-hook-form/pull/8501)
thanks, @bryantobing12
Published by bluebill1049 over 2 years ago
๐ fix https://github.com/react-hook-form/react-hook-form/issues/8493 error not trigger with delayError (https://github.com/react-hook-form/react-hook-form/pull/8494)
๐ fix null or undefined cases caught by TS ^4.8 (https://github.com/react-hook-form/react-hook-form/pull/8487)
๐ฅธ funnel along with appropriate constraints for (upcoming) TypeScript 4.8 (https://github.com/react-hook-form/react-hook-form/pull/8484)
thanks to @DanielRosenwasser
Published by bluebill1049 over 2 years ago
๐ feat: make UseFormRegisterReturn
generic over TFieldName
(https://github.com/react-hook-form/react-hook-form/pull/8414)
๐ fix https://github.com/react-hook-form/react-hook-form/issues/8459 regression issue with draft state object (https://github.com/react-hook-form/react-hook-form/pull/8463)
๐งพ fix: doc watch()
with callback example must deconstruct the returned type (https://github.com/react-hook-form/react-hook-form/pull/8451)
๐ค fix: compare html elements against correct global (https://github.com/react-hook-form/react-hook-form/pull/8355)
๐ flush errors
state update when user switch input with delayError (#8429)
thanks to @omjadas @Pika-Pool and @zenoamaro
Published by bluebill1049 over 2 years ago
๐งโ๐ป Support TypeScript 4.7+ ESM (https://github.com/react-hook-form/react-hook-form/pull/8390)
๐งพ Fix typo (https://github.com/react-hook-form/react-hook-form/pull/8389)
โน๏ธ fix export types order
๐ช upgrade to TS 4.7 (https://github.com/react-hook-form/react-hook-form/pull/8402)
๐ธ close https://github.com/react-hook-form/react-hook-form/issues/8404 use isWeb instead of globalThis (https://github.com/react-hook-form/react-hook-form/pull/8406)
๐ฅฌ save cloneObject bytes (https://github.com/react-hook-form/react-hook-form/pull/8407)
thanks to @davbrito, @rossng, @hwanyoungChoi and @Moshyfawn
Published by bluebill1049 over 2 years ago
๐ fix(reset): set isSubmitted
to formState value if keepIsSubmitted
is true
(https://github.com/react-hook-form/react-hook-form/pull/8368)
thanks to @blabute
Published by bluebill1049 over 2 years ago
๐ญ close #7472 include a proxy check with field state to improve useController
perf (#8334)
๐ fix #8339 Revert "๐ remove the reference for blob and file list (https://github.com/react-hook-form/react-hook-form/pull/8305)"
๐ฎ remove dead code (#8337)
thanks to @NMinhNguyen
Published by bluebill1049 over 2 years ago
๐ reset optional prop: keepDirtyValues (https://github.com/react-hook-form/react-hook-form/pull/8237)
reset(
{
firstName: "bill", // if firstName is dirty then the value will be retained
lastName: "luo"
},
{ keepDirtyValues: true } // keep any changed field
);
๐ฉโ๐ง close https://github.com/react-hook-form/react-hook-form/issues/8324 auto-correct field array errors on user action (https://github.com/react-hook-form/react-hook-form/pull/8325)
const { append } = useFieldArray()
append({ data: '' }) // will auto correct existing field array errors if any
๐ fix: clone objects which have functions (https://github.com/react-hook-form/react-hook-form/pull/8301)
๐ fix name of a new option in 6.12.0 change-log notes (https://github.com/react-hook-form/react-hook-form/pull/8335)
thanks to @Moshyfawn @airman5573 @TkDodo and @MasterOdin
Published by bluebill1049 over 2 years ago
๐ฃ determine checkbox group by defaultValues
set as array value (https://github.com/react-hook-form/react-hook-form/pull/7938)
useForm({
defaultValues: {
checkboxes: [], // register checkbox will be determine as array of checkboxes
},
});
register('checkboxes'); // will return array as value
๐งช improve test cases with checkbox default value as array (https://github.com/react-hook-form/react-hook-form/pull/7501)
๐ add fieldState invalid depreciation note (https://github.com/react-hook-form/react-hook-form/pull/8202)
โ improve getNodeParentName missing case(s) (https://github.com/react-hook-form/react-hook-form/pull/8181)
๐จ support field array parents with numbers in name (https://github.com/react-hook-form/react-hook-form/pull/8167)
๐ improve lib tests cases (https://github.com/react-hook-form/react-hook-form/pull/8155)
Thanks to contributors below โค๏ธ
Published by bluebill1049 over 2 years ago
โค๏ธ update react 18 peer dep
๐ฆ es2017 to es2018 (https://github.com/react-hook-form/react-hook-form/pull/8066) Reduce 1% of package weight
๐ avoid runtime error with compact (https://github.com/react-hook-form/react-hook-form/pull/8094)
๐ goodbye omit
(https://github.com/react-hook-form/react-hook-form/pull/8079)
๐ close https://github.com/react-hook-form/react-hook-form/issues/8071 issue on shouldUnreigster
mutate defaultValues (https://github.com/react-hook-form/react-hook-form/pull/8078)
โญ๏ธ close https://github.com/react-hook-form/react-hook-form/issues/8076 isMount
flag issue with useEffect running twice with react 18 (https://github.com/react-hook-form/react-hook-form/pull/8077)
๐ง close https://github.com/react-hook-form/react-hook-form/issues/8071 clean up at useForm useEffect (https://github.com/react-hook-form/react-hook-form/pull/8073)
Published by bluebill1049 over 2 years ago
๐ fix https://github.com/react-hook-form/react-hook-form/issues/8050 disabled attribute ignored with register checkbox (https://github.com/react-hook-form/react-hook-form/pull/8053)
๐ฆ update package.json to set sideEffect false (https://github.com/react-hook-form/react-hook-form/pull/8041)
๐ TS 4.6.0 (https://github.com/react-hook-form/react-hook-form/pull/7623)
๐ fix replace API TSDoc for fieldArray
thanks to @alexogar and @Moshyfawn
Published by bluebill1049 over 2 years ago
๐ฌ enable deps
with string syntax (https://github.com/react-hook-form/react-hook-form/pull/7901)
register('test', { deps: 'theOtherInput' })
register('test', { deps: ['theOtherInput', 'others'] })
๐งท fix field array update
to avoid external mutation
๐ fix https://github.com/react-hook-form/react-hook-form/issues/7960 issue on unset deeply nested array field (https://github.com/react-hook-form/react-hook-form/pull/7961)
๐ fix https://github.com/react-hook-form/react-hook-form/issues/7958 issue with checkbox plus portal (https://github.com/react-hook-form/react-hook-form/pull/7959)
๐ฆ unpack blob data type (https://github.com/react-hook-form/react-hook-form/pull/7937)
thanks to @DASPRiD and @Moshyfawn
Published by bluebill1049 over 2 years ago
๐ฌ enable deps with string syntax (https://github.com/react-hook-form/react-hook-form/pull/7901)
register('test', { deps: 'theOtherInput' })
๐งท fix field array update
to avoid external mutation
Published by bluebill1049 over 2 years ago
๐ fix https://github.com/react-hook-form/react-hook-form/issues/7853 (useFieldArray): pass context type down to Control (https://github.com/react-hook-form/react-hook-form/pull/7856)
๐ fix https://github.com/react-hook-form/react-hook-form/issues/7849 issue with unset on multiple dimension array (https://github.com/react-hook-form/react-hook-form/pull/7859)
thanks to @Moshyfawn
Published by bluebill1049 over 2 years ago
โจ https://github.com/react-hook-form/react-hook-form/issues/7138 feature: allow selecting input's content on focus (https://github.com/react-hook-form/react-hook-form/pull/7781)
setFocus('fieldName', { shouldSelect: true })
โจ๏ธ fix https://github.com/react-hook-form/react-hook-form/issues/7772 type issue by using UnpackNestedValue on FieldArray methods (https://github.com/react-hook-form/react-hook-form/pull/7773)
thanks to @Moshyfawn and @hpersson
Published by bluebill1049 over 2 years ago
๐ close https://github.com/react-hook-form/react-hook-form/issues/7758 useController
should subscribe to exact field name (https://github.com/react-hook-form/react-hook-form/pull/7759)
thanks to @Moshyfawn
Published by bluebill1049 over 2 years ago
๐ TSDoc
๐ fix https://github.com/react-hook-form/react-hook-form/issues/7741 is validating reset when async validations are still running (https://github.com/react-hook-form/react-hook-form/pull/7747)
โ close https://github.com/react-hook-form/react-hook-form/issues/7717 shallow clone errors object in handleSubmit (https://github.com/react-hook-form/react-hook-form/pull/7718)
๐ฆ close https://github.com/react-hook-form/react-hook-form/issues/7703 don't expose internal state in handleSubmit (https://github.com/react-hook-form/react-hook-form/pull/7704)
๐๏ธ save bytes on parseFloat (https://github.com/react-hook-form/react-hook-form/pull/7697)
thanks to @Moshyfawn and @tiii
Published by bluebill1049 over 2 years ago
๐ญ close #7686 regression on replace
API and cloneObject on payload (#7687)
Published by bluebill1049 over 2 years ago
โ๏ธ close #7683 support preact with onTouched
mode (#7684)
thanks to @Moshyfawn
Published by bluebill1049 over 2 years ago
๐ fix #7662 issue with reset
file input (#7656)
๐ improve perf with get proxy formState (#7655)
๐๏ธ remove redundant check (#7651)
๐ fix #7648 Unable to setFocus
to Controller after reset (#7649)
๐ fix: getFieldState
- error might be undefined (#7636)
โ improve useFieldArray code consistency (#7628)
thanks to @Moshyfawn and @michalbundyra
Published by bluebill1049 over 2 years ago
โจ new getFieldState
API: get individual field state
Documentation: https://react-hook-form.com/api/useform/getfieldstate
import * as React from "react";
import { useForm } from "react-hook-form";
export default function App() {
const {
register,
getFieldState,
formState: { isDirty, isValid }
} = useForm({
mode: "onChange",
defaultValues: {
firstName: ""
}
});
// you can invoke before render or within the render function
const fieldState = getFieldState("firstName");
return (
<form>
<input {...register("firstName", { required: true })} />
<p>{getFieldState("firstName").isDirty && "dirty"}</p>
<p>{getFieldState("firstName").isTouched && "touched"}</p>
<button type="button" onClick={() => console.log(getFieldState("firstName"))}>
field state
</button>
</form>
);
}