問題:
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