question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update the readme examples to use arrow functions instead to the function keyword

See original GitHub issue

Section/Content To Improve

Performing a GET request

const axios = require('axios');
// Make a request for a user with a given ID
axios.get('/user?ID=12345')
  .then(function (response) {
    // handle success
    console.log(response);
  })
  .catch(function (error) {
    // handle error
    console.log(error);
  })
  .then(function () {
    // always executed
  });

Suggested Improvement

Performing a GET request

const axios = require('axios');
// Make a request for a user with a given ID
axios.get('/user?ID=12345')
  .then(response => {
    // handle success
    console.log(response);
  })
  .catch(error => {
    // handle error
    console.log(error);
  })
  .then(()=> {
    // always executed
  });

Relevant File(s)

README.md

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
carpbencommented, Feb 12, 2022

@sanketpathak64 we first need to provide a rational - why is this change better. Using the function notation, the function word stands out and helps readability.

1reaction
carpbencommented, Feb 5, 2022

We need to provide reasoning for this sort of change.

  1. How wide is browser support?
  2. Does ESlint have this rule as part of their recommended list?
Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Use Javascript Arrow Functions & This Keyword
This guide will discuss how to use the arrow function to write your JavaScript functions. Focusing on converting regular functions to arrow ......
Read more >
https://raw.githubusercontent.com/microsoft/Web-De...
JavaScript Basics: Methods and Functions ![ ... Whenever we want to call (or invoke) our function, we use the name of the function...
Read more >
Arrow functions | Flutter by Example
For lack of better term, we'll call this an arrow function. Arrow functions implicitly return the result of the expression. => expression; is...
Read more >
eslint-config-travpro - npm
This rule enforces a specific function type for function components. For consistency we've opted to always use arrow functions. react/jsx-curly- ...
Read more >
README.md - Airbnb JavaScript Style Guide() - Sourcegraph
You can add new properties over time or change the order of things without ... 7.1 Use named function expressions instead of function...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found