问题:
I have a simple form in my render
function, like so:我的render
函数中有一个简单的表单,如下所示:
render : function() {
return (
<form>
<input type="text" name="email" placeholder="Email" />
<input type="password" name="password" placeholder="Password" />
<button type="button" onClick={this.handleLogin}>Login</button>
</form>
);
},
handleLogin: function() {
//How to access email and password here ?
}
What should I write in my handleLogin: function() { ... }
to access Email
and Password
fields?我应该在我的handleLogin: function() { ... }
写什么handleLogin: function() { ... }
以访问Email
和Password
字段?
解决方案:
参考一: https://en.stackoom.com/question/1aIX2参考二: https://stackoom.com/question/1aIX2