concept Component in category react native

appears as: Component
React Native in Action

This is an excerpt from Manning's book React Native in Action.

Here, you’re importing React directly from the React library using a default import and importing Component from the React library using a named import. You’re also using named imports to pull Text and View into your file.

Listing 2.2 Setting state with a constructor
import React {Component} from 'react'

class MyComponent extends Component {
  constructor(){
    super()
    this.state = {
      year: 2016,
      name: 'Nader Dabit',
      colors: ['blue']
    }
  }    
  render() {
    return (
      <View>
        <Text>My name is: { this.state.name }</Text>
        <Text>The year is: { this.state.year }</Text>
        <Text>My colors are { this.state.colors[0] }</Text>
      </View>
    )
  }
}