我有以下代码,我想获取在用户名和密码文本框中输入的值并将它们发送到节点 js 服务。但我不知道该怎么做。
事情是没有任何工作。我只能呈现页面,但功能不起作用,也无法从文本框中获取值。我对反应很陌生。
import { FormGroup} from "react-bootstrap";
import "./Login.css"
import "bootstrap/dist/css/bootstrap.min.css"
class LoginClassComponent extends React.Component {
constructor(props) {
super(props);
console.log(props);
this.state = {
username: '',
password: ''
}
this.handleTextChange = this.handleTextChange.bind(this);
this.handleValidation = this.handleValidation.bind(this);
}
handleTextChange = (event) => {
this.setState({ userName: event.target.value });
this.setState({ password: event.target.value });
}
handleValidation = (event) => {
console.log(this.props.userName);
if (!this.state.username) {
this.setState({ error: 'Please enter User Name' });
event.preventDefault();
}
else if (!this.state.password) {
this.setState({ error: 'Please enter Password' });
event.preventDefault(); …Run Code Online (Sandbox Code Playgroud) 我是反应和还原的新手。我已经浏览了很多关于 React Redux 的在线教程,但仍然无法理解 Action 和Reducer 是如何连接的。如果我是对的,我们在容器/组件中导入操作,在创建存储的文件中导入减速器。所以容器-action之间有联系,reducer和store之间也有联系,但在action文件中我们不导入reducer。那么action是如何连接到reducer的。我知道我们有一种类型的操作,将在减速器的开关盒中进行检查。但它是如何传递给reducer的呢?
我已经安装了Noed JS和NPM。我已经从 git 克隆了存储库并尝试在本地运行该应用程序。但我在运行应用程序时面临以下代理问题。
Run Code Online (Sandbox Code Playgroud)npm install nodemon npm ERR! code ENOTFOUND npm ERR! errno ENOTFOUND npm ERR! network request to https://registry.npmjs.com/nodemon failed, reason: getaddrinfo ENOTFOUND 28 npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm …
Material UI(用于反应应用程序)是免费的吗?我们计划在我们的应用程序中使用它,但在此之前需要检查是否有任何许可问题。在此先感谢您的帮助。
我正在尝试在我的 Web API 中实现 JWT 身份验证。我是第一次这样做。当我在 Google 上搜索一些教程时,第一步是显示将密钥保存在 appsettings.json 文件中。我被困在那个地方了。我如何知道并获取该密钥,以便将其存储在文件中。另外,我如何知道每个环境(即开发、测试和生产)的密钥。
提前致谢。
reactjs ×3
javascript ×2
.net-5 ×1
api-security ×1
c# ×1
jwt ×1
material-ui ×1
node.js ×1
npm ×1
proxy ×1
react-redux ×1