I understand that arrow functions make things more efficient by not recreating the functions each render similar to how binding in the constructor works.

This is not true. It depends on where exactly are you using the Arrow function. If Arrow function are used in render method, then they create a new instance everytime render is called just like how bind would work. Consider this example

<div onClick={()=>{this.onClick()}}>Previous</div>

Here each time render is called an anonymous function is created and that function when called, calls this.onClick.

However consider the case below

onClick = () => {
    console.log("Div is clicked")
}

In above case, the arrow function does not recreate function everytime, but binds the context to the React component as An arrow function does not have its own this; the this value of the enclosing execution context is used. once when the class is instantiated. This is similar to how binding works is constructor. This is a part of proposed class fields for arrow functions and it isn't a ES6 feature,

To understand what you wish to ask, you must know that a function gets its context from where it is called. Check this question for more understanding.

In your case, you have used Arrow function to define prevItem and hence it gets the context of the enclosing React component.

prevItem = () => {
    console.log("Div is clicked")
}

render(){
    return (
         <SecondClass prevItem={this.prevItem} />
    )
}

Now in its child, even if you call prevItem with any custom context, using bind or arrow function, prevItem when executed in parent i.e Main.js will get the context of its enclosing React component. And since you just wish to execute prevItem function and do not want to pass any data to this from the child, writing

<ThirdClass type="prev" onClick={()=>this.props.prevItem()} />

and

<div onClick={()=>{this.props.onClick()}}>Previous</div>

is simply useless and will only add to performance implication since new functions are created in SecondClass and ThirdClass everytime. You simply don't need to have these functions defined as arrow function and could just write

<ThirdClass type="prev" onClick={this.props.prevItem} />

and

<div onClick={this.props.onClick}>Previous</div>

since its already binded in the parent.

Now even if you have to pass some additional data to these function from ThirdClass and SecondClass, you shouldn't directly use Arrow function or bind in render. Have a look at this answer on How to Avoid binding in Render method

Answer from Shubham Khatri on Stack Overflow
🌐
W3Schools
w3schools.com › react › react_es6_arrow.asp
React ES6 Arrow Functions
React Compiler React Quiz React Exercises React Syllabus React Study Plan React Server React Interview Prep React Bootcamp React Certificate ... It gets shorter! If the function has only one statement, and the statement returns a value, you can remove the brackets and the return keyword: ... Note: This works only if the function has only one statement. If you have parameters, you pass them inside the parentheses: ... The handling of this is also different in arrow functions compared to regular functions.
Top answer
1 of 5
69

I understand that arrow functions make things more efficient by not recreating the functions each render similar to how binding in the constructor works.

This is not true. It depends on where exactly are you using the Arrow function. If Arrow function are used in render method, then they create a new instance everytime render is called just like how bind would work. Consider this example

<div onClick={()=>{this.onClick()}}>Previous</div>

Here each time render is called an anonymous function is created and that function when called, calls this.onClick.

However consider the case below

onClick = () => {
    console.log("Div is clicked")
}

In above case, the arrow function does not recreate function everytime, but binds the context to the React component as An arrow function does not have its own this; the this value of the enclosing execution context is used. once when the class is instantiated. This is similar to how binding works is constructor. This is a part of proposed class fields for arrow functions and it isn't a ES6 feature,

To understand what you wish to ask, you must know that a function gets its context from where it is called. Check this question for more understanding.

In your case, you have used Arrow function to define prevItem and hence it gets the context of the enclosing React component.

prevItem = () => {
    console.log("Div is clicked")
}

render(){
    return (
         <SecondClass prevItem={this.prevItem} />
    )
}

Now in its child, even if you call prevItem with any custom context, using bind or arrow function, prevItem when executed in parent i.e Main.js will get the context of its enclosing React component. And since you just wish to execute prevItem function and do not want to pass any data to this from the child, writing

<ThirdClass type="prev" onClick={()=>this.props.prevItem()} />

and

<div onClick={()=>{this.props.onClick()}}>Previous</div>

is simply useless and will only add to performance implication since new functions are created in SecondClass and ThirdClass everytime. You simply don't need to have these functions defined as arrow function and could just write

<ThirdClass type="prev" onClick={this.props.prevItem} />

and

<div onClick={this.props.onClick}>Previous</div>

since its already binded in the parent.

Now even if you have to pass some additional data to these function from ThirdClass and SecondClass, you shouldn't directly use Arrow function or bind in render. Have a look at this answer on How to Avoid binding in Render method

2 of 5
67

I understand that arrow functions make things more efficient by not recreating the functions each time they are referred to

This is not true.

Arrow functions handles the this context in a lexical way, where "normal" function do it dynamically. I wrote about the this key word in depth if you need more info about it.

On both of your examples of the inline arrow function, you are creating a new function instance on each render.
This will create and pass a new instance on each render

onClick={() => {}}

On the 3rd example you only have one instance.
This only pass a reference to an already existing instance

onClick={this.myHandler}


As for the benefits of arrow functions as class fields (there is a small down side, i will post it in the bottom of the answer), if you have a normal function handler that needs to access the current instance of the class via this:

myHandler(){
  //  this.setState(...)
}

You will need to explicit bind it to the class.
The most common approach will be to do it in the constructor because it runs only once:

constructor(props){
  super(props);
  this.myHandler = this.myHandler.bind(this);
}

If you use an arrow function as the handler though, you don't need to bind it to the class because as mentioned above, the arrow function use a lexical context for this:

myHandler = () => {
  //  this.setState(...)
}

With both approaches you will use the handler like this:

<div onClick={this.myHandler}></div> 

The main reason for taking this approach:

<div onClick={() => this.myHandler(someParameter)}></div>

Is if you want to pass parameters to the handler beside the native event that get passed, meaning you want to pass a parameter upwards.

As mentioned, this will create a new function instance on each render.
(There is a better approach for this, keep reading).

Running example for such use case:

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      items: [{ name: 'item 1', active: false }, { name: 'item 2', active: true }],
    }
  }
  toggleITem = (itemName) => {
    this.setState(prev => {
      const nextState = prev.items.map(item => {
        if (item.name !== itemName) return item;
        return {
          ...item,
          active: !item.active
        }
      });
      return { items: nextState };
    });
  }
  render() {
    const { items } = this.state;
    return (
      <div>
        {
          items.map(item => {
            const style = { color: item.active ? 'green' : 'red' };
            return (
              <div
                onClick={() => this.toggleITem(item.name)}
                style={style}
              >
                {item.name}
              </div>
          
          )})
        }
      </div>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('root'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<div id="root"></div>

A better approach would be to create component composition.
You can create a child component that wraps the relevant markup, will have it's own handler and will get both the data and handler as props from the parent.

The child component will then invoke the handler that it got from the parent and will pass the data as a parameter.

Running example with child component:

class Item extends React.Component {
  onClick = () => {
    const { onClick, name } = this.props;
    onClick(name);
  }
  render() {
    const { name, active } = this.props;
    const style = { color: active ? 'green' : 'red' };
    return (<div style={style} onClick={this.onClick}>{name}</div>)
  }
}

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      items: [{ name: 'item 1', active: false }, { name: 'item 2', active: true }],
    }
  }
  toggleITem = (itemName) => {
    this.setState(prev => {
      const nextState = prev.items.map(item => {
        if (item.name !== itemName) return item;
        return {
          ...item,
          active: !item.active
        }
      });
      return { items: nextState };
    });
  }
  render() {
    const { items } = this.state;
    return (
      <div>
        {
          items.map(item => {
            return <Item {...item} onClick={this.toggleITem} />
          })
        }
      </div>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('root'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<div id="root"></div>

Class Fields the down-side:
As i mentioned, there is a small down-side for class fields.
The difference between a class method and a class field is that the class field is attached to the instance of the class (constructor function).
where as the class methods and objects are attached to the prototype.

Hence, if you will have ridiculously large amount of instances of this class you may get a performance hit.

Given this code block:

class MyClass {
  myMethod(){}  
  myOtherMethod = () => {}
}

babel will transpile it to this:

var _createClass = function() {
  function defineProperties(target, props) {
    for (var i = 0; i < props.length; i++) {
      var descriptor = props[i];
      descriptor.enumerable = descriptor.enumerable || false;
      descriptor.configurable = true;
      if ("value" in descriptor) descriptor.writable = true;
      Object.defineProperty(target, descriptor.key, descriptor);
    }
  }
  return function(Constructor, protoProps, staticProps) {
    if (protoProps) defineProperties(Constructor.prototype, protoProps);
    if (staticProps) defineProperties(Constructor, staticProps);
    return Constructor;
  };
}();

function _classCallCheck(instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError("Cannot call a class as a function");
  }
}

var MyClass = function() {
  function MyClass() {
    _classCallCheck(this, MyClass);

    this.myOtherMethod = function() {};
  }

  _createClass(MyClass, [{
    key: "myMethod",
    value: function myMethod() {}
  }]);

  return MyClass;
}();
Discussions

Why is arrow syntax preferred over function declaration for functional React components?
I always see examples of functional React components defined with arrow function syntax: const foo = () => (...); export default foo; Rather than the more traditional function declaration synt... More on stackoverflow.com
🌐 stackoverflow.com
React - Can I define an arrow function inside Class Component
Tell us what’s happening: So I tried and it passes the test if I define the handleClick() method with an arrow function, but is there something wrong with it and should I keep it to the standard way - the normal ES6 way of defining a function? **Your code so far** class MyComponent extends ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
1
0
May 5, 2022
Arrows, function, or ???
For verbiage purposes you're talking about function declaration vs arrow syntax . It's important to note that they are functionally (no pun intended) different. The links above go into more depth but things like this binding and hoisting are present vs not respectively. There are places only function declaration can work. All that being said, for the most part I just encourage consistency. You're more likely to see/use arrow syntax in places like method callbacks because it's more terse. For that reason I typically just encourage using arrow syntax everywhere and breaking for function declaration only when necessary (rare). Consistency can be enforced with linting, but I typically don't find it necessary. More on reddit.com
🌐 r/reactjs
59
36
January 22, 2025
Is it necessary to use arrow function everywhere??
I've heard that the only place where they might cause performance issues is when used as an anonymous function and given as a parameter in the render() function. For example renderItem={() => (...)} When used like this, the function has to be re-created for each render, and in the case of FlatList, for each item in each render. More on reddit.com
🌐 r/reactnative
16
14
December 14, 2023
🌐
Medium
medium.com › @ramdhas › arrow-functions-in-react-js-a-practical-guide-with-examples-83f62a3c3bbd
Arrow Functions in React.js: A Practical Guide with Examples | by Ramdhas | Medium
January 22, 2024 - Arrow functions, on the other hand, have a lexical this binding, meaning they inherit the this value from the surrounding code. In React components, this is particularly useful as it allows you to access the component's this context without the need for manual binding. 4. Examples of Using Arrow Functions in React.js: Event Handlers: Arrow functions are commonly used for event handlers in React components.
🌐
Frontend Armory
frontarm.com › james-k-nelson › when-to-use-arrow-functions
When should I use arrow functions with React? – Frontend Armory
You can see this for yourself in the example below, where the functions a and b are equivalent, but not equal: ... import React from 'react' import ReactDOM from 'react-dom' const a = (x) => x, b = (x) => x ReactDOM.render( <div> <h3>Are <code>a</code> and <code>b</code> equal by ...
🌐
Educative
educative.io › answers › what-are-arrow-functions-in-reactjs
What are arrow functions in ReactJS?
An arrow function created within a class component · On line 16, we create the handleClick() function as an arrow function, hence we don't need to bind it.
🌐
DEV Community
dev.to › livelong_ponder › arrow-functions-and-state-in-react-2ama
Arrow Functions and State in React - DEV Community
February 13, 2023 - When there are no parameters, you'll ... little easier to understand arrow the below arrow function. React const increment = () => setCount(prevCount => prevCount + 1);...
🌐
Scaler
scaler.com › topics › arrow-functions-in-react-js
React ES6 Arrow Functions - Scaler Topics
October 4, 2023 - Suppose we want to create a functional component that displays a "Hello, React!" message as a heading. In this example, we've defined a functional component called Greeting using an Arrow Function.
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › what-is-the-arrow-function-in-reactjs
What is the Arrow Function in ReactJS?
November 7, 2022 - Arrow functions offer a compressed and short version of a function expression and need fewer keystrokes than regular JavaScript functions from the developer and can be used as a simpler alternative to functions within class components and functional components and event handlers in React.
Top answer
1 of 6
31

I would say that this is a bit opinionated choice really. There are at least several reasons why I (personally) see arrow function use for a purely functional component as pretty bad practice. Here are those:

  1. Syntax abuse. When we define function component we don't need to pre-bind its context to a specific scope. The context (this) is going to be undefined anyway in the module namespace. The use of arrow functions is dictated here by pure aesthetics reasons like conciseness. But arrow functions as language feature has a very specific purpose for existence in the first place, and this is not coolness and conciseness.

  2. Error stack trace. Exceptions thrown in arrow function will be less descriptive because arrow function is anonymous by definition. This is not the huge problem probably since React project will most likely be configured with proper source maps support, but still stack trace will be a bit more clear if named function is used. As noted in comments this is not really an issue of the functional component, as the name will be the name of the variable basically.

  3. Less convenient logging. Consider this very typical pure function component style:

    const Header = ({ name, branding }) => (
      <header>
        ...
      </header>
    )
    

    In the function above it's impossible to throw in quick debugger statement or console.log. You will have to temporarily convert it to something like this

    const Header = function ({ name, branding }) { 
      console.log(name)
      return (
        <header>
          ...
        </header>
      )
    }
    

    This might be pretty annoying especially for bigger pure functional components.

That being said this is a very popular choice for many teams, also by default preferred by ESLint, so if you don't see the problem with it, then it is probably okay.

2 of 6
31

Actually, there is no difference between them, I made a little project on the CodeSandBox and made two simple components, one of them is the Arrow component by using the arrow function:

import React from 'react';

const MyArrowComponent = () => (
  <main>
    <h2>Arrow</h2>
  </main>
);

export default MyArrowComponent;

And the other is the Declaration component by using function declaration:

import React from "react";

function MyFunctionComponent() {
    return (
        <main>
            <h2>Declaration</h2>
        </main>
    );
}

export default MyFunctionComponent;

Then I ran the yarn build command and got the bundle like the one below:

(window.webpackJsonp = window.webpackJsonp || []).push([[0], {
  14: function (e, n, t) {
    "use strict";
    t.r(n);
    var a = t(0), r = t.n(a), l = t(2),
        c = t.n(l), u = t(3), i = t(4), o = t(6), m = t(5), E = t(7);
    var p = function () {
      return r.a.createElement("main", null, r.a.createElement("h2", null, "Declaration"))
    }, s = function () {
      return r.a.createElement("main", null, r.a.createElement("h2", null, "Arrow"))
    }, d = function (e) {
      function n() {
            return (
              Object(u.a)(this, n),
              Object(o.a)(this, Object(m.a)(n).apply(this, arguments))
      }
      return Object(E.a)(n, e), Object(i.a)(n, [{
        key: "render", value: function () {
          return r.a.createElement(
            'div',
            null,
            r.a.createElement('div', null, 'Hi'),
            r.a.createElement(p, null),
            r.a.createElement(s, null)
          );
        }
      }]), n
    }(r.a.Component);
    c.a.render(r.a.createElement(d, null), document.getElementById("root"))
  }, 8: function (e, n, t) {
    e.exports = t(14)
  }
}, [[8, 1, 2]]]);

Pay attention to the definition of the Arrow and the Declaration component:

var p = function () {
  return r.a.createElement("main", null, r.a.createElement("h2", null, "Declaration"))
}, s = function () {
  return r.a.createElement("main", null, r.a.createElement("h2", null, "Arrow"))
}

Both of them are defined in the same way, so there is no difference between them and it is fully opinion based on developers' attitude to code readability and clean code, based on ESLint 5.x in our team, we chose the arrow function to define the functional components.

🌐
DhiWise
dhiwise.com › post › ways-to-implement-custom-arrow-wraps-in-react-components
Implementing Custom Arrow Wraps in React Components
February 8, 2024 - React hooks and arrow functions complement each other well. Hooks allow functional components to manage state and side effects, and arrow functions provide a clean and concise way to define these components and their behavior. For example, the useState and useEffect hooks are often used with arrow functions:
🌐
DEV Community
dev.to › austinbh › javascript-arrow-functions-28p9
Why You Should Use Arrow Functions in React - DEV Community
August 2, 2019 - Example three will be able to return this without being bound in the constructor because the arrow function expression allows it to inherit the 'this' definition from the App constructor. As a result this allows us to write React functions without having to explicitly bind this.
🌐
sebhastian
sebhastian.com › react-arrow-function
Should you use arrow functions in React components? | sebhastian
November 9, 2020 - The arrow function is far more concise than the regular function syntax, but when you use it inside React, it has the following benefits as well: The regular function syntax changes the context of this keyword. When you write a class component, you can’t call on this.setState without binding the function that calls it. The following example ...
🌐
Medium
oleg008.medium.com › arrow-functions-in-react-f782d11460b4
Arrow functions in React. Some thoughts on inline arrow… | by Oleg Isonen | Medium
August 7, 2018 - Using inline arrow functions in function components is a good way to achieve some decoupling. In class-based components we have a choice: either to generate an inline callback or to use a class method. I usually go for class methods, just because I prefer to keep JSX as clean as possible, but the main benefit of using methods is to generate the callback only once when React instantiates the class.
🌐
MageComp
magecomp.com › home › reactjs › what is arrow function in reactjs?
What is Arrow Function in ReactJS?
February 27, 2025 - The arrow function is a compressed and shorter version of the function expression. It requires fewer keystrokes by developers. In React, arrow functions are used as an alternative to functions within class components, functional components, and event handlers.
🌐
Robin Wieruch
robinwieruch.de › react-function-component
React Function Components - Robin Wieruch
December 23, 2024 - By providing an event handler to the input field, we are able to do something with a callback function when the input field changes its value. As argument of the callback function we receive a synthetic React event which holds the current value of the input field. This value is ultimately used to set the new state for the Function Component with an inline arrow function.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Functions › Arrow_functions
Arrow function expressions - JavaScript - MDN Web Docs
February 21, 2026 - Note: Class fields are defined on the instance, not on the prototype, so every instance creation would create a new function reference and allocate a new closure, potentially leading to more memory usage than a normal unbound method. For similar reasons, the call(), apply(), and bind() methods are not useful when called on arrow functions, because arrow functions establish this based on the scope the arrow function is defined within, and the this value does not change based on how the function is invoked.
🌐
W3Schools
w3schools.com › react › react_es6.asp
React ES6
React ES6 ES6 Classes ES6 Arrow Functions ES6 Variables ES6 Array map() ES6 Destructuring ES6 Spread Operator ES6 Modules ES6 Ternary Operator ES6 Template Strings React JSX Intro React JSX Expressions React JSX Attributes React JSX If Statements React Components React Class React Props React ...
🌐
Quora
quora.com › What-is-the-arrow-function-in-React-How-is-it-used
What is the arrow function in React? How is it used? - Quora
Answer (1 of 2): Technically, the arrow function is not part of React but comes from Javascript. > An arrow function expression is a compact alternative to a traditional function expression, but is limited and can't be used in all situations. Basic syntax: [code](param1, paramN) => expression ...
🌐
Delft Stack
delftstack.com › home › howto › react › react arrow function
How to Use of Arrow Functions in React Components | Delft Stack
February 2, 2024 - The syntax for using arrow functions in React components is fairly simple. Let’s look at a simple example of arrow functions that do not take any arguments and return one expression: