From 98aea8cdf0870325857b890ef46d8a9f1588bd28 Mon Sep 17 00:00:00 2001 From: Jonathan Sagorin Date: Sun, 5 Mar 2017 22:43:07 -0800 Subject: [PATCH] Update State.md Summary: Changes to setState will cause re-renders. **Test plan (required)** Textual changes only - on Markdown only Make sure tests pass on both Travis and Circle CI. **Code formatting** Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide). For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests). Closes https://github.com/facebook/react-native/pull/12647 Differential Revision: D4658053 Pulled By: ericvicenti fbshipit-source-id: 0d9cde8f9710b4e0f7d7f82214d8eeda0bf3c135 --- docs/State.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/State.md b/docs/State.md index 9f4b644e1e6..f9e62c2b081 100644 --- a/docs/State.md +++ b/docs/State.md @@ -53,8 +53,9 @@ class BlinkApp extends Component { AppRegistry.registerComponent('BlinkApp', () => BlinkApp); ``` -In a real application, you probably won't be setting state with a timer. You might set state when you have new data arrive from the server, or from user input. You can also use a state container like [Redux](http://redux.js.org/index.html) to control your data flow. In that case you would use Redux to modify your state rather than calling `setState` directly. +In a real application, you probably won't be setting state with a timer. You might set state when you have new data arrive from the server, or from user input. You can also use a state container like [Redux](http://redux.js.org/index.html) to control your data flow. In that case you would use Redux to modify your state rather than calling `setState` directly. -State works the same way as it does in React, so for more details on handling state, you can look at the [React.Component API](https://facebook.github.io/react/docs/component-api.html). +When setState is called, BlinkApp will re-render its Component. By calling setState within the Timer, the component will re-render every time the Timer ticks. +State works the same way as it does in React, so for more details on handling state, you can look at the [React.Component API](https://facebook.github.io/react/docs/component-api.html). At this point, you might be annoyed that most of our examples so far use boring default black text. To make things more beautiful, you will have to [learn about Style](docs/style.html).