componentWillMount(): Assigning directly to this.state is deprecated
See original GitHub issueUse 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:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sure.
Maybe reopen the issue then, to indicate that it present.