this.props.navigation.state.params.picture генерирует TypeError: Cannot read property 'picture' of undefined
Я хочу проверить, читаемо это или нет.
componentDidMount = async () => {
try {
let varPicPath = this.props.navigation.state.params.picture;
if (typeof varPicPath === 'undefined') {
console.warn('hi' + varPicPath);
}
} catch (error) {
console.warn(error);
}
};
если я напишу let varPicPath;
вместо let varPicPath = this.props.navigation.state.params.picture;
тогда console.warn
печатает hi undefined
Надеюсь, вы получите точку.