Skip to content
This repository has been archived by the owner on Oct 11, 2020. It is now read-only.

remove superfluous useCallback #44

Merged
merged 1 commit into from
Sep 25, 2019
Merged

Conversation

kentcdodds
Copy link
Contributor

When people see useCallback used like this without explanation for why, they'll just assume they should put all callbacks within a useCallback which is not a good thing.

@danielkcz
Copy link
Collaborator

danielkcz commented Sep 24, 2019

Maybe I am still misunderstanding something conceptual, but I've used the Form there on purpose to signify there might be some more complex logic behind it. For example, if you would have useEffect inside the Form component that would for some reason need to depend on onSubmit, it would cause unnecessary re-runs of that effect without useCallback in parent. Isn't that correct?

@kentcdodds
Copy link
Contributor Author

My point is that there's nuance for when it's appropriate to use useCallback and given that the nuance is not present here, including it is misleading.

@danielkcz
Copy link
Collaborator

Ok fair enough, it should be probably explained if used.

@danielkcz danielkcz merged commit e815f0e into mobxjs:master Sep 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants