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

refac: Add a dependency array for useEffect #1243

Closed
wants to merge 2 commits into from

Conversation

ssi02014
Copy link

What:

I added a dependency array for useEffect.

What:
It would be clearer to add a dependency array, and some code already has one.

Checklist:

  • Documentation added to the
    docs site
  • Tests
  • TypeScript definitions updated
  • Ready to be merged

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 10, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d1ff5d6:

Sandbox Source
React Configuration
react-testing-library-examples Configuration

@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Merging #1243 (d1ff5d6) into main (d80319f) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##              main     #1243   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          192       192           
  Branches        40        40           
=========================================
  Hits           192       192           
Flag Coverage Δ
canary 100.00% <ø> (ø)
experimental 100.00% <ø> (ø)
latest 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/pure.js 100.00% <ø> (ø)

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@MatanBobi
Copy link
Member

Having an empty dependency array in useEffect does not have the same behavior as not having a dependency array, one will run only on mount and the second will run on every re-render. I'm not sure this change is needed here.
Thanks for putting the time and effort into this, but I'm closing this PR :)

@MatanBobi MatanBobi closed this Apr 24, 2024
@ssi02014 ssi02014 deleted the pr/refac-useEffect branch April 24, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants