Skip to content

Commit 803f864

Browse files
docs: follow guidelines for reset in simple example (#1531)
* docs: follow guidelines for reset in simple example * ci: apply automated fixes and generate docs --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 75a442d commit 803f864

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

examples/react/simple/src/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,14 @@ export default function App() {
9898
<button type="submit" disabled={!canSubmit}>
9999
{isSubmitting ? '...' : 'Submit'}
100100
</button>
101-
<button type="reset" onClick={() => form.reset()}>
101+
<button
102+
type="reset"
103+
onClick={(e) => {
104+
// Avoid unexpected resets of form elements (especially <select> elements)
105+
e.preventDefault()
106+
form.reset()
107+
}}
108+
>
102109
Reset
103110
</button>
104111
</>

0 commit comments

Comments
 (0)