From a484f30bc58ab169275c0076483f667734da41cb Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 17 Nov 2016 14:23:20 +0000 Subject: [PATCH] Tweak examples --- docs/docs/forms.md | 10 +++++----- docs/docs/uncontrolled-components.md | 24 ++++++++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/docs/docs/forms.md b/docs/docs/forms.md index 8724ea58ed..d7c06e33a9 100644 --- a/docs/docs/forms.md +++ b/docs/docs/forms.md @@ -29,7 +29,7 @@ We can combine the two by making the React state be the "single source of truth" For example, if we want to make the previous example log the name when it is submitted, we can write the form as a controlled component: -```javascript{4,10-12,23} +```javascript{4,10-12,24} class NameForm extends React.Component { constructor(props) { super(props); @@ -62,7 +62,7 @@ class NameForm extends React.Component { } ``` -[Try it on CodePen.](https://codepen.io/lacker/pen/oYNzxY?editors=0010) +[Try it on CodePen.](https://codepen.io/gaearon/pen/VmmPgp?editors=0010) Since the `value` attribute is set on our form element, the displayed value will always be `this.state.value`, making the React state the source of truth. Since `handleChange` runs on every keystroke to update the React state, the displayed value will update as the user types. @@ -86,7 +86,7 @@ In HTML, a `