鉴于:
登录用户名.re
let component = ReasonReact.statelessComponent("LoginUsername");
let make = (~value: string, _children) => {
...component,
render: (_) =>
<div>
<label htmlFor="username">{ReasonReact.string("User Name")}</label>
<input type_="text" name="username" value=value/>
</div>
};
登录密码.re
let component = ReasonReact.statelessComponent("LoginPassword");
let make = (~value, _children) => {
...component,
render: (_) =>
<div>
<label htmlFor="password">{ReasonReact.string("Password")}</label>
<input type_="password" name="password" value=value/>
</div>
};
登录.re
let component = ReasonReact.statelessComponent("Login");
let make = (~username: string, ~password: string, _children) => {
...component,
render: (_) =>
<div>
<h1>{ReasonReact.string("Log in")}</h1>
<div><LoginUsername key=username value=username/></div>
<div><LoginPassword key=password value=password/></div>
</div>
};
索引.re
ReactDOMRe.renderToElementWithId(<Login username="" password=""/>, "index1");
索引.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ReasonReact Examples</title>
</head>
<body>
Component 1:
<div id="index1"></div>
<script src="../build/Index.js"></script>
</body>
</html>
为什么我输入的时候没有文字出现<input>
?