deno.com

按钮带有类型

检查 <button> JSX 元素是否具有有效的 type 属性。默认值为 "submit",这通常不是期望的行为。

无效示例

<button />
<button type="foo" />
<button type={condition ? "foo" : "bar"} />
<button type={foo} />
<button type={2} />

有效示例

<button type="submit" />
<button type="button" />
<button type="reset" />
<button type={condition ? "button" : "submit"} />

您找到所需内容了吗?

隐私政策