Skip to content

Commit

Permalink
docs: Reverse recommendation for controlled inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
rschristian committed Feb 28, 2024
1 parent ccab39c commit 83022b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/en/guide/v10/forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ A framework like Preact in contrast generally has a unidirectional data flow. Th
<input value={someValue} onInput={myEventHandler} />;
```

Generally, you should try to use _Controlled_ Components at all times. However, when building standalone Components or wrapping third-party UI libraries, it can still be useful to simply use your component as a mount point for non-preact functionality. In these cases, "Uncontrolled" Components are nicely suited to the task.
Generally, you should try to use _Uncontrolled_ Components whenever possible. The DOM is fully capable of handling `<input>`'s state. However, there are situations in which you may need to have tighter control over the input value, in which case, "Controlled" Components can be used.

> One gotcha to note here is that setting the value to `undefined` or `null` will essentially become uncontrolled.
Expand Down

0 comments on commit 83022b7

Please sign in to comment.