Code Monkey home page Code Monkey logo

Comments (4)

maslianok avatar maslianok commented on August 13, 2024 1

This feature lands in v.2.2.0.
Thanks to @lamhieu-vk :)

from react-resize-detector.

maslianok avatar maslianok commented on August 13, 2024

Hi @Eric24,
You can handle it on your own

import debounce from 'lodash/debounce';

class YourComponent extends Component {
  constructor(props) {
    super(props);
    this.onResizeDebounced = debounce(this.onResize, 1000);
  }

  onResize = () => {
    // will be executed once per second
  }

  render() {
    // ...
    <ReactResizeDetector onResize={this.onResizeDebounced} />
  }
}

from react-resize-detector.

Eric24 avatar Eric24 commented on August 13, 2024

Sure (and that's my current solution). I just thought it would be a good thing to build into the component.

from react-resize-detector.

maslianok avatar maslianok commented on August 13, 2024

Well, it's hard to foresee all users needs. Someone may want to trigger this event at the beginning/end and someone doesn't (leading/trailing option for debounce). Someone may need throttle instead of debounce etc.

That's why I prefer to keep this library simple and to not overcomplicate things by adding all this stuff for everyone... I think it's very simple to achieve what you need without integrating additional modules into the library.

Hope this explains my position.

Anyway, thanks for your suggestion!

from react-resize-detector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.