Skip to content

Feature Request: PureWatch #23

@guillaumearm

Description

@guillaumearm

Hi 🙂

Let's say I have a class component decorated by the Watch HOC and I only want to use enterViewport and leaveViewport props from outside this component.

My component re-render each-time one of this props change when I don't even use them :

"isBelowViewport"
"isInViewport"
"isAboveViewport"
"isFullyInViewport"
"lockWatcher"
"unlockWatcher"
"startWatcher"
"stopWatcher"
"enterViewport"
"exitViewport"
"onApplicationAdded"

The main idea is to have a way to replace this : https://github.com/stutrek/scrollmonitor-react/blob/master/index.js#L159 by something like :

const omitInternalProps = obj => require('lodash.omit')(obj, [
  'autoStart',
  'innerRef',
  'stateChange',
  'visibilityChange',
  'enterViewport',
  'fullyEnterViewport',
  'exitViewport',
  'partiallyExitViewport',
]);

return (
  <Component {...omitInternalProps(this.props))}>
     {this.props.children}
  </Component>
);

@stutrek what do you think ? Did I miss something ? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions