deno.com

button-has-type

检查 <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"} />

你找到你需要的东西了吗?

隐私政策