From ba15818e7d2c97bbed074b45cb80baac1b38aa01 Mon Sep 17 00:00:00 2001 From: Tex Andersen Date: Thu, 11 Apr 2024 01:01:22 +1000 Subject: [PATCH] Fix broken code example in FastField API docs + update CONTRIBUTING.md `master` references to `main` (#3958) Title pretty much summarises it. --- .github/CONTRIBUTING.md | 6 +++--- docs/api/fastfield.md | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b58951398..1193bd4d0 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -69,8 +69,8 @@ git remote add upstream https://github.com/formik/formik.git 3. Synchronize your local `next` branch with the upstream one: ```sh -git checkout master -git pull upstream master +git checkout main +git pull upstream main ``` 4. Install the dependencies with [yarn](https://yarnpkg.com) (npm isn't supported): @@ -122,7 +122,7 @@ the results. If any of them fail, refer to [Checks and how to fix them](#checks- Make sure the following is true: -- The branch is targeted at `master` for ongoing development. We do our best to keep `master` in good shape, with all tests passing. Code that lands in `master` must be compatible with the latest stable release. It may contain additional features, but no breaking changes. We should be able to release a new minor version from the tip of `master` at any time. +- The branch is targeted at `main` for ongoing development. We do our best to keep `main` in good shape, with all tests passing. Code that lands in `main` must be compatible with the latest stable release. It may contain additional features, but no breaking changes. We should be able to release a new minor version from the tip of `main` at any time. - If a feature is being added: - If the result was already achievable with the library, explain why this feature needs to be added. - If this is a common use case, consider adding an example to the documentation. diff --git a/docs/api/fastfield.md b/docs/api/fastfield.md index cd9d7b1bf..32fa48ee3 100644 --- a/docs/api/fastfield.md +++ b/docs/api/fastfield.md @@ -57,7 +57,8 @@ const Basic = () => ( alert(JSON.stringify(values, null, 2)); }, 500); }} - render={formikProps => ( + > + {formikProps => (
{/** This only updates for changes made to values.firstName, touched.firstName, errors.firstName */} @@ -66,8 +67,8 @@ const Basic = () => ( {/** Updates for all changes because it's from the top-level formikProps which get all updates */} - {form.touched.firstName && form.errors.firstName && ( -
{form.errors.firstName}
+ {formikProps.touched.firstName && formikProps.errors.firstName && ( +
{formikProps.errors.firstName}
)} @@ -105,7 +106,7 @@ const Basic = () => ( and all changes by all s and s */} - {() => ( + {({ field, form, meta }) => (
{/** Works because this is inside @@ -125,7 +126,7 @@ const Basic = () => ( )} - /> +
); ```