Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken code example in FastField API docs + update CONTRIBUTING.md master references to main #3958

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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>
);
```