Skip to content

Commit

Permalink
Fix broken code example in FastField API docs + update CONTRIBUTING.m…
Browse files Browse the repository at this point in the history
…d `master` references to `main` (#3958)

Title pretty much summarises it.
  • Loading branch information
texonidas authored Apr 10, 2024
1 parent f22eb8e commit ba15818
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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.
Expand Down
11 changes: 6 additions & 5 deletions docs/api/fastfield.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ const Basic = () => (
alert(JSON.stringify(values, null, 2));
}, 500);
}}
render={formikProps => (
>
{formikProps => (
<Form>
{/** This <FastField> only updates for changes made to
values.firstName, touched.firstName, errors.firstName */}
Expand All @@ -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 && (
<div>{form.errors.firstName}</div>
{formikProps.touched.firstName && formikProps.errors.firstName && (
<div>{formikProps.errors.firstName}</div>
)}

<label htmlFor="middleInitial">Middle Initial</label>
Expand Down Expand Up @@ -105,7 +106,7 @@ const Basic = () => (
and all changes by all <Field>s and <FastField>s */}
<label htmlFor="lastName">LastName</label>
<Field name="lastName" placeholder="Baby">
{() => (
{({ field, form, meta }) => (
<div>
<input {...field} />
{/** Works because this is inside
Expand All @@ -125,7 +126,7 @@ const Basic = () => (
<button type="submit">Submit</button>
</Form>
)}
/>
</Formik>
</div>
);
```

0 comments on commit ba15818

Please sign in to comment.