From ff19f79a331f84e5461d6a82d4aa28587d45c53f Mon Sep 17 00:00:00 2001 From: Jim Date: Thu, 16 Jul 2015 19:13:31 -0700 Subject: [PATCH] Merge pull request #4379 from eriklharper/patch-1 Add more information about defaultValue (cherry picked from commit 976b51adf8aef9357fb1cf6289bda4e041c3c727) --- docs/docs/07-forms.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/docs/07-forms.md b/docs/docs/07-forms.md index 0ca639b927..938d5f6c2b 100644 --- a/docs/docs/07-forms.md +++ b/docs/docs/07-forms.md @@ -81,6 +81,8 @@ An `` that does not supply a `value` (or sets it to `null`) is an *uncont This will render an input that starts off with an empty value. Any user input will be immediately reflected by the rendered element. If you wanted to listen to updates to the value, you could use the `onChange` event just like you can with controlled components. +###Default Value + If you want to initialize the component with a non-empty value, you can supply a `defaultValue` prop. For example: ```javascript @@ -89,7 +91,7 @@ If you want to initialize the component with a non-empty value, you can supply a } ``` -This example will function much like the **Controlled Components** example above. +This example will function much like the **Controlled Components** example above. *Note:* the defaultValue prop is only applied when the component mounts for the first time. If you need to programmatically update the value after initial mount, you will need to use a controlled component (see section on controlled components). Likewise, `` supports `defaultChecked` and `