I needed to refactor my stateless functional component to a class. When I did so though, I keep getting an error where it looks like React itself is undefined.
import React from 'react';
import { Cell } from 'fixed-data-table';
const DataCell = ({rowIndex, columnKey, data, onMessageClicked, ...props}) => {
return (
<Cell {...props} onClick={onMessageClicked(data[rowIndex].Id)}>
{data[rowIndex][columnKey]}
</Cell>
);
};
export default DataCell;
to
import { React, Component } from 'react';
import { Cell } from 'fixed-data-table';
class DataCell extends Component {
onCellClicked() {
this.props.onMessageClicked(this.props.data[this.props.rowIndex].Id);
}
render() {
const {rowIndex, columnKey, data, ...props} = this.props;
return (
<Cell {...props} onClick={onCellClicked}>
{data[rowIndex][columnKey]}
</Cell>
);
}
}
export default DataCell;
bundle.js:43248 Uncaught (in promise) TypeError: Cannot read property 'createElement' of undefined(…)
and when I go to that line I see
return _react.React.createElement(
I don't get it. How do I debug/fix this?
My full code for this app is here in case the code I'm posting is not related somehow.
Thanks!