Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IE10-11, setState does not mutate the state #98

Open
max-ch9i opened this issue Feb 15, 2017 · 2 comments
Open

IE10-11, setState does not mutate the state #98

max-ch9i opened this issue Feb 15, 2017 · 2 comments

Comments

@max-ch9i
Copy link

setState inside a timeout callback does not mutate the state. Encountered in IE10 and IE11.

componentDidMount() {
    setTimeout(_ => this.setState({param: true}), 1000);
}

When I switched to the original react, it worked as expected. Could it be due to issues with transpiling?

@Lucifier129
Copy link
Owner

Lucifier129 commented Feb 17, 2017

I checked it in my machine, the state of component is changed by setState in IE9 & IE10 & IE11, the code is in bleow

// use create-react-app
import React, { Component } from 'react-lite'
import ReactDOM from 'react-lite'

class App extends Component {
	state = {
		count: 0
	}
	componentDidMount() {
		setTimeout(_ => this.setState({count: 1}), 1000);
	}
	render() {
		return <div>{this.state.count}</div>
	}
}

ReactDOM.render(<App />, document.getElementById('root'))

@max-ch9i
Copy link
Author

@Lucifier129 Thank you for checking. I'll try to isolate this bit of code and try again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants