Summary: TLDR even more docs changes So I created a More Resources doc that aggregates the high-quality-but-off-site stuff. Let's try to put more outlinks there. Also I removed the stuff on Support that was not support, and some misc changes to clean stuff up. Closes https://github.com/facebook/react-native/pull/8329 Differential Revision: D3471669 Pulled By: JoelMarcey fbshipit-source-id: 54edd543ced1b3a8f3d0baca5475ac96bae6e487
1.7 KiB
id | title | layout | category | permalink | next |
---|---|---|---|---|---|
basics-components | Components | docs | The Basics | docs/basics-components.html | basics-component-text |
Components are the building blocks for a React Native application. A React Native user interface (UI) is specified by declaring components, often nested. Those components are then mapped to the native UI on the targeted platform.
####Props####
#####this.props
#####
Components can be configured by passing properties props
to the constructor. You can access props
from your component's methods by accessing this.props
. You should not alter your props within component methods.
####State####
#####this.state
#####
Components maintain their state using the state object. You can access your component state via this.state
. Each component should manage its own state. Parent components should not manage children state and children components should not manage parent component state.
#####this.setState({key: value, ...})
#####
To update or change the state of your component passing a new object representing your newly desired state to this.setState(obj)
. The specificed keys will be merged into this.state
. Any existing keys will be overridden by new values.
Core Components.
React Native has a number of core components that are commonly used in applications, either on their own or combined to build new components.