I have the following code and every time I try to access the state inside of the return I got a
TypeError: Cannot read property '#property' of null
import React, {useEffect, Fragment} from 'react'
import {Row, Col} from 'react-bootstrap'
import {connect} from 'react-redux';
import PropTypes from 'prop-types'
import {getProduct} from '../../actions/produto'
const Product = ({getProduct, match, produto: {produto}}) => {
    useEffect(() => {
        getProduct(match.params.id);
    }, [getProduct, match.params.id]);
    console.log(produto);
    return (
        <Fragment>
            <Row>
                <Col>
                    {produto.name}
                </Col>                
            </Row>
        </Fragment>
    )
}
Product.propTypes = {
    getProduct: PropTypes.func.isRequired,
    produto: PropTypes.object.isRequired
}
const mapStateToProps = (state) =>({
    produto: state.produto
})
export default connect(mapStateToProps, {getProduct})(Product)
However if I console.log(produto) before the return I can get the real state value. The state has the correct value until I try access {produto} inside the return statement. When I do that it changes to null. Can someone explain me why does this happens and how to fix it?
Thank you