Skip to content

Commit ba15818

Browse files
authored
Fix broken code example in FastField API docs + update CONTRIBUTING.md master references to main (#3958)
Title pretty much summarises it.
1 parent f22eb8e commit ba15818

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

.github/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ git remote add upstream https://github.com/formik/formik.git
6969
3. Synchronize your local `next` branch with the upstream one:
7070

7171
```sh
72-
git checkout master
73-
git pull upstream master
72+
git checkout main
73+
git pull upstream main
7474
```
7575

7676
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-
122122

123123
Make sure the following is true:
124124

125-
- 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.
125+
- 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.
126126
- If a feature is being added:
127127
- If the result was already achievable with the library, explain why this feature needs to be added.
128128
- If this is a common use case, consider adding an example to the documentation.

docs/api/fastfield.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ const Basic = () => (
5757
alert(JSON.stringify(values, null, 2));
5858
}, 500);
5959
}}
60-
render={formikProps => (
60+
>
61+
{formikProps => (
6162
<Form>
6263
{/** This <FastField> only updates for changes made to
6364
values.firstName, touched.firstName, errors.firstName */}
@@ -66,8 +67,8 @@ const Basic = () => (
6667

6768
{/** Updates for all changes because it's from the
6869
top-level formikProps which get all updates */}
69-
{form.touched.firstName && form.errors.firstName && (
70-
<div>{form.errors.firstName}</div>
70+
{formikProps.touched.firstName && formikProps.errors.firstName && (
71+
<div>{formikProps.errors.firstName}</div>
7172
)}
7273

7374
<label htmlFor="middleInitial">Middle Initial</label>
@@ -105,7 +106,7 @@ const Basic = () => (
105106
and all changes by all <Field>s and <FastField>s */}
106107
<label htmlFor="lastName">LastName</label>
107108
<Field name="lastName" placeholder="Baby">
108-
{() => (
109+
{({ field, form, meta }) => (
109110
<div>
110111
<input {...field} />
111112
{/** Works because this is inside
@@ -125,7 +126,7 @@ const Basic = () => (
125126
<button type="submit">Submit</button>
126127
</Form>
127128
)}
128-
/>
129+
</Formik>
129130
</div>
130131
);
131132
```

0 commit comments

Comments
 (0)