-
Notifications
You must be signed in to change notification settings - Fork 39
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
Inconsistencies in the way how inputs
are handled in some hooks
#78
Comments
What react does is, if you don't pass // useCallback
const inputsNext = inputs !== undefined && inputs !== null ? inputs : [callback];
const dirty = shallowEqualsArray(inputsNext, inputsPrev); |
Hey Malte 😃I've created a codesandbox to see React's behavior (open the console): From what I can see:
If any of the above are passed a constant array (eg. If on a re-render any of the above have I've not seen Melody's behaviour, but I presume it is different right now? |
I think it makes sense to align the behaviour. That'd make it more predictable. |
Hey @jamesb3ll 😍 |
Has been fixed in #80 |
Explain the problem
We have some inconsistencies in the way how
inputs
(second argument ofuseEffect
,useMemo
,useCallback
) are handledExpected Behaviour
All hooks should have the same way of handling
inputs
. In ReactuseEffect
,useMemo
,useCallback
all have the same API:Actual Behaviour
Maybe I'm missing something, but I think there was no good reason why these hooks have a different API. We should make them consistent. I'm happy to create a PR. What do you think?
The text was updated successfully, but these errors were encountered: