8000 hooks lifecycle does not work as expected · Issue #12 · garthenweb/react-viewport-utils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
hooks lifecycle does not work as expected #12
Closed
@garthenweb

Description

@garthenweb

In case options or the function for a hook changes, the hook is not updated. This can lead to unexpected behavior.
Maybe we should take the function reference into consideration for adding and removing listeners,
but this would require to wrap all function with useCallback like in the following example:

const scroll = useScrollEffect(useCallback((scroll) => doStuff(scroll), [doStuff]))

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0