我通过create-react-app创建了一个Reactjs应用。
...但是组件未在页面中显示,我认为可能是因为App.js没有呈现组件?
这是我的代码:
App.js
import React, { Component } from 'react';
import './App.css';
import login from "./containers/login/login";
class App extends Component {
render() {
return (
<div className="App">
<login/>
</div>
);
}
}
export default App;
/containers/login/login.js
import React, { Component } from 'react';
import "./login.css";
class login extends Component {
render() {
return (
<div className="headings">
<form action="">
Username <br/>
<input type="text" name="userrname" />
<br/>
Password <br/>
<input type="password" name="password" />
<br/>
<input type="submit" value="Login" />
</form>
</div>
);
}
}
export default login;
浏览器中的组件如下:
<login></login>
答案 0 :(得分:3)
您自己的部分需要以大写字母或Babel will treat them as strings开头。
将变量重命名为// stores all async responses
const responses2 = IDs.map((id) => promisefy(id));
// executes sequentially all responses
responses2
.reduce((_, resp, index) => {
return resp.then((value) => console.log(`id: ${value}, index: ${index}`));
}, null)
.then(() => console.log('done'));
,它将起作用。
Login