Do you want to request a feature or report a bug?
bug
What is the current behavior?
In React v16, the callback function that is an optional parameter to the setState function is called and passed a value of null. Previously, in React v15, the function was called with a value of undefined. This change breaks the default parameters feature of JavaScript.
I discovered this behavior while working on a React Native project (hence the example using View & Text).
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/84v837e9/).
import React, {
Component,
} from 'react';
export default class MyComp extends Component {
componentDidMount() {
this.setState({}, (val) => console.log(val))
}
render() {
return (
<View>
<Text>{this.props.climbs}</Text>
</View>
);
}
}
What is the expected behavior?
The callback function will be called with undefined
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Broken behavior was observed in React 16 alpha 12 and React Native 0.45.1.
I replicated the issue in React 15.4.1 and React Native 0.40.0 and it was working as expected.
Do you want to request a feature or report a bug?
bug
What is the current behavior?
In React v16, the callback function that is an optional parameter to the
setStatefunction is called and passed a value of null. Previously, in React v15, the function was called with a value of undefined. This change breaks the default parameters feature of JavaScript.I discovered this behavior while working on a React Native project (hence the example using View & Text).
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/84v837e9/).
What is the expected behavior?
The callback function will be called with undefined
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Broken behavior was observed in React 16 alpha 12 and React Native 0.45.1.
I replicated the issue in React 15.4.1 and React Native 0.40.0 and it was working as expected.