Skip to content

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