score:1

Accepted answer

the answer is yes you access props only inside component. try to do it like this

const setoptions (props) = {
const options = {
    chart: {
        type: 'line'
    },
    title: {
        text: 'price history'
    },
    xaxis: {
        title: {
            text: 'date of change'
        },
        categories: [...props.time]
    },
    yaxis: {
        title: {
            text: 'price in $'
        }
    },
    series: [
        {
            name: 'price',
            data: [...props.price]
        }
    ]
}
}

score:1

change last two lines to,

export default connect(mapstatetoprops)(pricehistory);

to connect component we have to pass our component as the function parameter to the connect api.


Related Query

More Query from same tag