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

React의 useEffect를 mount시점에 태우고 싶지 않다면? #49

Open
BKJang opened this issue Apr 5, 2020 · 0 comments
Open

React의 useEffect를 mount시점에 태우고 싶지 않다면? #49

BKJang opened this issue Apr 5, 2020 · 0 comments
Labels
completed This is completed. React This is related to React. Tip This is tip for developement.

Comments

@BKJang
Copy link
Owner

BKJang commented Apr 5, 2020

const useDidMountEffect = (func, deps) => {
  const didMount = useRef(false);

  useEffect(() => {
    if (didMount.current) func();
    else didMount.current = true;
  }, deps);
}
@BKJang BKJang added in progress This is in progress. React This is related to React. Tip This is tip for developement. completed This is completed. and removed in progress This is in progress. labels Apr 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed This is completed. React This is related to React. Tip This is tip for developement.
Projects
None yet
Development

No branches or pull requests

1 participant