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

Hooks!!! #467

Merged
merged 13 commits into from
May 15, 2019
Merged

Hooks!!! #467

merged 13 commits into from
May 15, 2019

Conversation

erikras
Copy link
Member

@erikras erikras commented May 13, 2019

This is a complete rewrite of 🏁 React Final Form (obviously much of the logic was saved), away from ES6 classes and lifecycle methods, to use only React Hooks. Believe it or not, this provides even better control of how, and in which stages of the render cycle, 🏁 React Final Form communicates with its internal 🏁 Final Form instance.

It also includes a migration of all of the tests to use 🐐 React Testing Library, which is a superior testing environment.

Late one insomniatic night, it occurred to me that all of the hooks logic that was internal to Field and FormSpy could be exported for public consumption, so it was all abstracted out into useField and useFormState hooks respectively.

@codecov
Copy link

codecov bot commented May 13, 2019

Codecov Report

Merging #467 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #467   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          10     15    +5     
  Lines         210    224   +14     
  Branches       62     57    -5     
=====================================
+ Hits          210    224   +14
Impacted Files Coverage Δ
src/FormSpy.js 100% <100%> (ø) ⬆️
src/useField.js 100% <100%> (ø)
src/useFormState.js 100% <100%> (ø)
src/ReactFinalForm.js 100% <100%> (ø) ⬆️
src/useWhenValueChanges.js 100% <100%> (ø)
src/useForm.js 100% <100%> (ø)
src/renderComponent.js 100% <100%> (ø) ⬆️
src/testUtils.js 100% <100%> (ø)
src/useConstant.js 100% <100%> (ø)
src/Field.js 100% <100%> (ø) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 41d24d6...ef289e6. Read the comment docs.

@erikras
Copy link
Member Author

erikras commented May 13, 2019

This pull request introduces 1 alert and fixes 1 when merging de77bb3 into 41d24d6 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

fixed alerts:

  • 1 for Unused variable, import, function or class

Comment posted by LGTM.com

README.md Show resolved Hide resolved
src/Field.js Outdated Show resolved Hide resolved
src/FormSpy.js Outdated Show resolved Hide resolved
src/ReactFinalForm.js Outdated Show resolved Hide resolved
src/ReactFinalForm.js Outdated Show resolved Hide resolved
src/useField.js Outdated Show resolved Hide resolved
justingrant added a commit to justingrant/react-final-form-hooks that referenced this pull request May 14, 2019
Hooks are coming to React Final Form!  final-form/react-final-form#467

This PR adds a paragraph to the readme of `react-final-form-hooks` to let people know that there's also hooks work going on in the main RFF codebase. Given that Googling "react final form hooks" will end up on this page for the forseeable future, it's useful to warn folks who're looking to use more hooks that they will soon have another option besides `react-final-form-hooks`.
README.md Show resolved Hide resolved
erikras pushed a commit to final-form/react-final-form-hooks that referenced this pull request May 14, 2019
* Cross-ref docs about hooks coming to RFF V5 

Hooks are coming to React Final Form!  final-form/react-final-form#467

This PR adds a paragraph to the readme of `react-final-form-hooks` to let people know that there's also hooks work going on in the main RFF codebase. Given that Googling "react final form hooks" will end up on this page for the forseeable future, it's useful to warn folks who're looking to use more hooks that they will soon have another option besides `react-final-form-hooks`.

* Fixed typos
@erikras
Copy link
Member Author

erikras commented May 14, 2019

This pull request introduces 1 alert and fixes 1 when merging 1abd7f3 into 41d24d6 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

fixed alerts:

  • 1 for Unused variable, import, function or class

Comment posted by LGTM.com

src/Field.js Outdated Show resolved Hide resolved
src/useField.js Outdated Show resolved Hide resolved
src/useFormState.js Outdated Show resolved Hide resolved
@erikras
Copy link
Member Author

erikras commented May 14, 2019

This pull request introduces 1 alert and fixes 1 when merging 2f2ca8a into 41d24d6 - view on LGTM.com

new alerts:

  • 1 for Unused variable, import, function or class

fixed alerts:

  • 1 for Unused variable, import, function or class

Comment posted by LGTM.com

@erikras
Copy link
Member Author

erikras commented May 14, 2019

This pull request fixes 1 alert when merging 9a7125b into 41d24d6 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

Comment posted by LGTM.com

@erikras
Copy link
Member Author

erikras commented May 14, 2019

This pull request fixes 1 alert when merging c1408c5 into 41d24d6 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

Comment posted by LGTM.com

@erikras
Copy link
Member Author

erikras commented May 15, 2019

This pull request fixes 1 alert when merging 4870a83 into 41d24d6 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

Comment posted by LGTM.com

@erikras
Copy link
Member Author

erikras commented May 15, 2019

This pull request fixes 1 alert when merging 0b786ab into 41d24d6 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

Comment posted by LGTM.com

@erikras
Copy link
Member Author

erikras commented May 15, 2019

This pull request fixes 1 alert when merging ef289e6 into 41d24d6 - view on LGTM.com

fixed alerts:

  • 1 for Unused variable, import, function or class

Comment posted by LGTM.com

@lock
Copy link

lock bot commented Jun 14, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants