I have a react component which looks like this.
import React, { PropTypes, Component } from 'react';
import { Accordion, Panel, PanelGroup, Table } from 'react-bootstrap';
const FormCell = ({ data }) => (
<div>
<a className="pdf-name" onClick={this.doSomething}>{data.item.extension.nameCodeDes}</a>
</div>
);
class Docs extends Component {
constructor(props) {
super(props);
this.doSomething= this.doSomething.bind(this);
}
doSomething() {
setTimeout(() => {
console.log("here we are");
})
}
// ...
}
Docs.defaultProps = {
tableData: null,
cols: null,
metaData: {
documentsColumnMetaData: [
{
displayName: 'Policy/Account',
columnComponent: {
component: FormCell,
actions: [],
},
},
],
},
};
export default Docs;
The this.doSomething is transpiled to undefined.doSomething in dev tools. I get an error Cannot read property 'downloadDocument' of undefined. Can someone please let me know what I'm missing here? P.S FormCell does more that what is posted. I reduced the code for simplicity