Bomber
Bomber

Reputation: 10957

mapStateToProps wont display state in render

I am trying to display my state in my render()

I am referencing my state this.props.UserDetails.accessCode

    <tbody>
                <tr>
                    <td>What is your access code</td>
                    <td>
                        {this.props.UserDetails.accessCode}
                    </td>
                </tr>

and using mapStatetoProps

const mapStateToProps = store => {
    return {
        UserDetails: store,
    };
};

My values appear empty? Any ideas?

Upvotes: 1

Views: 57

Answers (1)

aherriot
aherriot

Reputation: 4725

I can't be certain what the shape of your store looks like, but when you write:

return {
   UserDetails: store,
};

are you sure you don't mean?

return {
   UserDetails: store.UserDetails,
};

Upvotes: 4

Related Questions