Giter VIP home page Giter VIP logo

Comments (3)

developit avatar developit commented on May 1, 2024

@jobsboris27: ah, sorry, that is an older example and I moved it into the wiki without checking if it had been broken. The error is because it's not checking if this[i] is actually a function before calling .bind() on it, so it's trying to bind things like this.state, which is an object.

Will update the demo.

from preact.

jobsboris27 avatar jobsboris27 commented on May 1, 2024

@developit thanks!

from preact.

developit avatar developit commented on May 1, 2024

@jobsboris27 The issue was due to Babel correcting it's behavior to match the ES6 spec: class methods are non-enumerable, which makes it impossible to auto-bind them at runtime (since you can't list what methods a class has).

I've modified the example to use an explicit list:
https://jsfiddle.net/developit/cty6ybrq/5/
https://github.com/developit/preact/wiki/Extending-Component

Thanks for noticing this!

from preact.

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.