Skip to content

Add high-order component. #3

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add high-order component. #3

wants to merge 2 commits into from

Conversation

srph
Copy link

@srph srph commented Feb 11, 2016

What

  • Adds a resize HOC as discussed in As HOC #1
  • This adds a additional dependencies on omit and merge.

So far, I can't write any tests because:

  • I think the API I just wrote sucks (but I think it matches the original API).
  • The tests doesn't seem to be originally working:
Error: TypeError: 'undefined' is not a function (evaluating 'RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/)')

Usage

import resize 'react-window-resize-listener/resize'; // lmao

@resize
class C extends Component {
  render() {
    console.log(this.props); // { windowWidth, windowHeight }
  }
}

I think we should put it in a property so we don't pollute the props, e.g., this.props.window.width.

No pressure! Thanks for your work ;). Feedback is welcome!

srph added 2 commits February 12, 2016 01:27
This adds a additional dependencies on `omit` and `merge`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant