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

Pick a username Email Address Password Sign up for rwandachamber.org

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

Already on rwandachamber.org? Sign in to your account




You are watching: React native undefined is not an object

*
peterrz commented Sep 26, 2020

Description

Passing data params to another components and unfortunately i face this error TypeError: undefined is not an object (evaluating "this.state.dataset.Image<0>"), while i run console.log(this.state.dataset); the data is there but i can"t reach them.I set a condition in render and it makes me access the data if (this.state.dataset && this.state.dataset),would you please give me more info about this error. thanks

React Native version:

System:OS: Linux 4.15 Ubuntu 18.04.4 LTS (Bionic Beaver)CPU: (4) x64 Intel(R) Core(TM) i5-3570 CPU
3.40GHzMemory: 165.87 MB / 7.67 GBShell: 4.4.20 - /bin/bashBinaries:Node: 12.18.3 - ~/.nvm/versions/node/v12.18.3/bin/nodeYarn: Not Foundnpm: 6.14.8 - ~/react/SEC/node_modules/.bin/npmWatchman: Not FoundSDKs:Android SDK:API Levels: 23, 28, 29Build Tools: 23.0.1, 28.0.3, 29.0.2, 29.0.3System Images: android-28 | Intel x86 Atom_64, android-28 | Google Play Intel x86 AtomAndroid NDK: Not FoundIDEs:Android Studio: Not FoundLanguages:Java: 1.8.0_252 - /usr/bin/javacPython: 2.7.17 - /usr/bin/pythonnpmPackages:
react-native-community/cli: Not Foundreact: 16.13.1 => 16.13.1react-native: 0.63.2 => 0.63.2npmGlobalPackages:react-native: Not Found

Steps To Reproduce

1.render() { console.log(this.state.dataset.Image<0>.Src) ...}

Expected Results

accessing to data

Extra information


export default class Detail extends Component { constructor(props) { super(props); this.state = { dataset:"", } } async componentDidMount(){ this.setState({ dataset: this.props.router.params.data, }); } render() { console.log(this.state.dataset.Image<0>.Src) . . }
<br> <img class=Nes Multi Cartridge ' Super Games 150 In 1 50 In 1' (Region