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.

componentWillMount(): Assigning directly to this.state is deprecated

See original GitHub issue

Use react-mixin with react@16.0.0-beta.3 (maybe also in 15.6.x) will output warning:

Warning: XComponent.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component’s constructor). Use setState instead.

Seems https://github.com/brigand/react-mixin/blob/master/index.js#L37-L45 calls applyInitialState, and applyInitialState at https://github.com/brigand/react-mixin/blob/master/index.js#L30 calls instance.state = ...

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
brigandcommented, Nov 21, 2017

Sure.

0reactions
OEvgenycommented, Nov 20, 2017

Maybe reopen the issue then, to indicate that it present.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ComponentWillMount warning - reactjs - Stack Overflow
Yes, because the componentWillMount and componentWillReceiveProps getting deprecated soon in React. I suggest you to use componentDidMount ...
Read more >
Warning: componentWillMount has been Renamed, and is not ...
Warning: componentWillMount has been renamed, and is not recommended for use. Initializing state // Before class AppComponent extends React.
Read more >
React: componentWillMount to be deprecated! - Northcoders
After either a component is created or when it receives a prop, getDerivedStateFromProps is called to return a new state. componentWillUpdate.
Read more >
React.Component
The render() method is the only required method in a class component. ... Constructor is the only place where you should assign this.state...
Read more >
Lifecycle deprecated/New Methods - React Training
deprecated — componentWillMount · update state via this.setState · perform last minute optimization · cause side-effects (AJAX calls etc.) in case of server-side- ......
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