Skip to content

null is not an object (evaluating 'this.state.noteArray') #13495

Closed
@IsmaelEzequiel

Description

@IsmaelEzequiel

Why Im getting this error while I already have my constructor?

` export default class testPoject extends Component {
constructor(props) {
super(props);
this.state = {noteArray: []}
}

render() {

let notes = this.state.noteArray.map((val, key) => {
    return <Note key={key} keyval={key} val={val} deleteMethod={ () => this.deleteNote(key)} />
});

return (
<View style={styles.container}>

        <View style={styles.header}>
            <Text style={styles.headerText}>TODO LIST  </Text>
        </View>

        <ScrollView style={styles.scrollConainer}>

        </ScrollView>

        <View style={styles.footer}>

            <TouchableOpacity style={styles.addButton}>
                <Text style={styles.addButtonText}>
                    +
                </Text>
            </TouchableOpacity>

            <TextInput style={styles.noteInputText}
                placeholder="> Note"
                placeholderTextColor="#FFF"
                underlineColorAndroid="transparent"
                numberOfLines = {3}
            />

        </View>

</View>
);

}`

To have a better look at my code, you can take a look here: https://github.com/IsmaelEzequiel/Sample_React_Native_App/blob/master/index.android.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions