Mohammad Shahzaib
Mohammad Shahzaib

Reputation: 74

undefined is not an object (evaluating 'this.props = props') React-Native expo

Just started the project and sucked

Code:

import React, {Component} from 'react';
import { Text, View } from 'react-native';
export default class SignUp extends Component() {
    constructor(props){
        super(props);
    }
    render() {
        return (
            <View>
                <Text>SignUp</Text>
            </View>
        );
    }
}

stack navigator:

import { createStackNavigator } from "react-navigation";
import SignUp from "../screens/SignUpScreen";

export default AuthStackNavigator = createStackNavigator({
    SignUp: SignUp,
})

Getting this error:

error pic

Upvotes: 0

Views: 259

Answers (1)

Hurobaki
Hurobaki

Reputation: 4058

It’s because you should write

export default class SignUp extends Component { ... } 

Instead of

export default class SignUp extends Component() { ... }

Upvotes: 2

Related Questions