Skip to content Skip to sidebar Skip to footer

ReactJs Cannot Access Props

I am trying to access the props in my child component, I am rendering a grid row using a mapped json result: getRowNodes: function() { return this.props.contacts.map(function(c

Solution 1:

Like Kirill Slatin said: You have to wrap it.

Try this:

getRowNodes() {
    return (
        <div>
            {this.props.contacts.map(this._getRow)}
        </div>
    );
},

_getRow(contact) {
    return (
        <Row 
            key={contact.id}
            contact={contact}
            columns={this.props.children} />
    );
}

NOTE: I have optimized the readability by using JSX Syntax.


Post a Comment for "ReactJs Cannot Access Props"