In the getEvaluation function I get the number 1, I want to change the state with this value:
type Props = {
};
type State = {
id_evaluation: string,
};
class Evaluation extends Component < Props, State > {
state = {
id_evaluation: '1',
}
componentDidMount() {
const id_eval = getEvaluation();
this.setState({
id_evaluation: id_eval,
});
I checked now 'console.log(typeof(id_eval)), is string.
Flow generates this error:
Cannot call
this.setStatewith object literal bound topartialStatebecause null or undefined [1] is incompatible with string [2].