Ritu Sharma
Ritu Sharma

Reputation: 77

How to use props in ES5 React native

I am new to react native and I am using ES5 standard and I don't know how to use props in ES5.Please help me and please do share snippet....

const SharePhotoPage= React.createClass({

    render() {

        return (
                <View >
                </View>
        );
    },
});

Upvotes: 2

Views: 176

Answers (1)

nahoang
nahoang

Reputation: 2478

Because you use React.createClass instead of ES6 class, you should call getInitialState() to init state and pass props to it. For example:

    var Header = React.createClass({
    getInitialState: function() {
        return {
            title: this.props.title
        };
    },
});

Cheer!

Upvotes: 1

Related Questions