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
This commit is contained in:
Jonathan Sagorin 2017-03-05 22:43:07 -08:00 committed by Facebook Github Bot
parent c4e73ddd92
commit caa9d848d6
1 changed files with 3 additions and 2 deletions

View File

@ -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).