babel-plugin-react-transform
babel-plugin-react-transform copied to clipboard
Guard access to node.key when finding displayName
This PR addresses an issue where use of the spread operator inside of a component spec causes getDisplayName to fail, since SpreadOperator nodes don't have a key property.
Example class:
const definition = {};
React.createClass({
...definition,
displayName: 'TestClass',
});
Error output:
TypeError: Cannot read property 'name' of undefined while parsing file: <file>