This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
key on React Component does not compile #300
Closed
Description
Is this a bug report?
Yes
Can you also reproduce the problem with npm 4.x?
Yes
Which terms did you search for in User Guide?
key
Module build failed: TypeError: Cannot read property 'length' of undefined
Environment
D:\repos\zzz_react_ts>npm ls react-scripts-ts
zzz_react_ts@0.1.0 D:\repos\zzz_react_ts
`-- react-scripts-ts@2.14.0
D:\repos\zzz_react_ts>node -v
v9.4.0
D:\repos\zzz_react_ts>npm -v
4.6.1
Then, specify:
- Operating system: Windows 10
- Browser and version (if relevant):
Chrome 65
Steps to Reproduce
npm install -g create-react-app
create-react-app zzz --scripts-version=react-scripts-ts
cd zzz
npm start
(Write your steps here:)
- Replace App.tsx with the following content:
import * as React from 'react';
import './App.css';
const MyComp = () => <div>bar</div>;
class App extends React.Component {
render() {
return (
<div>
{[0, 1, 2].map(n => <MyComp key={n}/>)}
</div>
);
}
}
export default App;
Expected Behavior
You should see no error in the browser, and a loop printed.
Actual Behavior
Error in the browser:
./src/App.tsx
Module build failed: TypeError: Cannot read property 'length' of undefined
The bug is on MyComp key={n}
Reproducible Demo
Metadata
Metadata
Assignees
Labels
No labels