Uncaught TypeError with React
How do I use this with React? I was getting the error:
Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_8_orgchart___default.a is not a constructor
with the following:
`import React, { Component } from 'react'; import OrgChart from 'orgchart';
class Configuration extends Component{ constructor(props){ super(props); this.state = { currency: null }; } render(){ let datasource = { 'name': 'Lao Lao', 'title': 'general manager', 'children': [ { 'name': 'Bo Miao', 'title': 'department manager' }, { 'name': 'Su Miao', 'title': 'department manager', 'children': [ { 'name': 'Tie Hua', 'title': 'senior engineer' }, { 'name': 'Hei Hei', 'title': 'senior engineer', 'children': [ { 'name': 'Pang Pang', 'title': 'engineer' }, { 'name': 'Xiang Xiang', 'title': 'UE engineer' } ] } ] }, { 'name': 'Yu Jie', 'title': 'department manager' }, { 'name': 'Yu Li', 'title': 'department manager' }, { 'name': 'Hong Miao', 'title': 'department manager' }, { 'name': 'Yu Wei', 'title': 'department manager' }, { 'name': 'Chun Miao', 'title': 'department manager' }, { 'name': 'Yu Tie', 'title': 'department manager' } ] }, orgchart = new OrgChart({ 'chartContainer': '#chart-container', 'data' : datasource, 'depth': 2, 'nodeContent': 'title' }); return (
</div>
);
}
}
export default Configuration; `
Sorry about my markdown formatting
Hi @abiodunsulaiman694 , feel free to play around this Demo on codepen.io. Hope it's hopeful for you 😊
@dabeng. Thanks so much. The error is cleared now, but for some reason, my style does not seem to work. I uploaded the snapshot below. Thanks.

Thanks @dabeng I fixed it by requiring the css from my index.js root file. Thank you
Thanks @dabeng I fixed it by requiring the css from my index.js root file. Thank you
What file did you require?