I am just starting to learn React Native and I'm a bit confused. The docs say to use:
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var { StyleSheet, TabBarIOS, Text, View, } = ReactNative;
However when I run:
react-native init MyApp
I get this code:
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
TabBarIOS,
Text,
View
} from 'react-native';
Can someone please explain the difference and which one I should be using. When I try to create a component with the 'strict' I get this error:
Seems you're trying to access 'ReactNative.Component' from the 'react-native' package. Perhaps you meant to access 'React.Component' from the 'react' package instead?
So why do all the docs say to use the first method ? I'm really confused on this.