whatisgithub

What is autobind-decorator?

gaearon/autobind-decorator — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2015-08-23

6JavaScriptAudience · developerComplexity · 2/5DormantSetup · moderate

In one sentence

A JavaScript decorator that automatically binds class methods to their instance, fixing the common 'this is undefined' bug.

Mindmap

mindmap
  root((repo))
    What it does
      Fixes lost this binding
      Auto-binds class methods
      Works on method or class
    Tech stack
      JavaScript
      Babel
      core-js
    Use cases
      React event handlers
      Cleaner class methods
      Avoid manual bind calls
    Audience
      JavaScript developers
      React developers
    Setup
      Needs Babel transpiler
      Install core-js

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Fix React component methods that lose their 'this' context when passed to onClick handlers.

USE CASE 2

Automatically bind every method in a class at once instead of binding each one manually.

USE CASE 3

Write cleaner class methods without scattering manual .bind(this) calls throughout the constructor.

What is it built with?

JavaScriptBabelcore-js

How does it compare?

gaearon/autobind-decoratorarthurmoorgan/driftatom/etch-list-view
Stars666
LanguageJavaScriptJavaScriptJavaScript
Last pushed2015-08-232020-04-28
MaintenanceDormantDormant
Setup difficultymoderatemoderatemoderate
Complexity2/52/52/5
Audiencedevelopergeneraldeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires Babel to compile decorator syntax plus core-js for supporting JavaScript features.

No license information is mentioned in the explanation.

Copy-paste prompts

Prompt 1
Show me how to use @autobind to fix a React onClick handler losing its this context.
Prompt 2
Help me set up Babel so I can use the @autobind decorator syntax in my project.
Prompt 3
Explain the difference between binding one method versus binding an entire class with this decorator.
Prompt 4
Help me migrate this code that uses @autobind decorators to plain arrow functions instead.
Prompt 5
Why do I need core-js installed alongside this autobind decorator?

Frequently asked questions

What is autobind-decorator?

A JavaScript decorator that automatically binds class methods to their instance, fixing the common 'this is undefined' bug.

What language is autobind-decorator written in?

Mainly JavaScript. The stack also includes JavaScript, Babel, core-js.

Is autobind-decorator actively maintained?

Dormant — no commits in 2+ years (last push 2015-08-23).

What license does autobind-decorator use?

No license information is mentioned in the explanation.

How hard is autobind-decorator to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is autobind-decorator for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.