I have implemented this chart example in my application
See the image on how this is composed
The problem is that i can only show my charts correctly filled with the data if my nums data are hardcoded like this const nums = [32, 19, 47, 38, 17, 62, 94, 21, 59, 62];
export default class ChartsGrid extends React.Component{
render() {
const view = [480, 320];
const trbl = [0, 0, 0, 0]
const horizontalAxisHeight = 30;
const verticalAxisWidth = 42;
const nums = [32, 19, 47, 38, 17, 62, 94, 21, 59, 62];
return (
<div className="grid">
<LineChart {...{view, trbl, nums, horizontalAxisHeight, verticalAxisWidth}} />
</div>
)
}
};
If i declare my data as props const { nums } = this.props; in my ChartsGrid component then i get this error in my LineChart Component
TypeError: Cannot read property 'length' of undefined
This is beacuse it is complaining about the nums in the render function in LineChart
const {view, trbl, nums, horizontalAxisHeight, verticalAxisWidth} = this.props;
my nums data are actually consumible in the store (I can see it in the console)
num.js
const nums = [32, 19, 47, 38, 17, 62, 94, 21, 59, 62];
export default nums;
reducer.js
import { combineReducers } from 'redux';
import { routerReducer } from 'react-router-redux';
import nums from './nums';
const rootReducer = combineReducers({nums, routing: routerReducer });
export default rootReducer;
store
import rootReducer from './reducers/index';
const store = createStore(rootReducer);
export default store;
This the logic to store the data num.js
so why then LineChart can not read them?

reduxtag. Can you include yourconnectcode that connects your component to the store?