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.

`no-unused-prop-types` and `getDerivedStateFromProps`

See original GitHub issue

no-unused-prop-types should take into account usages from new React lifecycles

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:29
  • Comments:31 (16 by maintainers)

github_iconTop GitHub Comments

13reactions
jinliming2commented, Apr 27, 2018

Waiting for this.

8reactions
mrbinky3000commented, May 17, 2018

eslintrc file in the project root foler

{
    // this left intentionally blank
}

eslintrc file in the folder that contains our react app

{
  "extends": [
    "airbnb"
  ],
  "settings": {
    "react": {
      "pragma": "React",
      "version": "16.3"
    },
  },
  "parser": "babel-eslint",
  "env": {
    "browser": true,
    "node": true
  },
  "plugins": [
    "react",
    "jsx-a11y"
  ],
  "rules" {
     ... a few rule tweaks, none dealing with unused props.
  }
  "globals": {
    "expect": true,
    "PRODUCTION": true,
    "VERSION": true,
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

You Probably Don't Need Derived State – React Blog
When to Use Derived State. getDerivedStateFromProps exists for only one purpose. It enables a component to update its internal state as the ...
Read more >
Lifecycle, state, getDerivedStateFromProps and Hooks - Medium
This new lifecycle function is meant as replacement to componentWillReceiveProps which is unsafe for async rendering when misused.
Read more >
Why getDerivedStateFromProps is called after setState?
The way getDerivedStateFromProps hook works whenever the new props, setState, and forceUpdate is being received.
Read more >
componentWillReceiveProps vs getDerivedStateFromProps ...
Hello We have found a scenario where the removal of componentWillReceiveProps will encourage us to write worse code than we currently do.
Read more >
ReactJS – getDerivedStateFromProps() Method - Tutorialspoint
This method is majorly used to update the state, before the rendering of the component, which depends upon the props received by the...
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