Learning React Native with no prior knowledge of React and I have a question about exporting


So I’ve been trying to go through the React Native course so that I won’t utterly fail my current semester at school (another story) and we’ve not been given any information on React, only React Native.

I started the Codecademy course and I’m a little confused about the exercise 8/9 on the above linked exercise, pertaining to combining components.

Now, I managed to get the exercise completed by using the View Solution option (Honestly, the questions are worded really confusingly for someone who has no React knowledge) and I don’t understand why the Box component in this particular exercise is being exported.

I tried removing the export keyword and everything still works absolutely fine, so I was hoping someone could help me understand why it’s being exported?

Is it so that, later on, were we to build this particular app out further, we would need to export it for it to be accessible in other .js files, but to access it just within the app.js file we’re working on, we don’t need to export it?

Posted code below in case the link doesn’t go to the right place.

import React from 'react';

import { View, Text } from 'react-native';

const App = () => (

  <View style={{ flex: 1, justifyContent: 'center' }}>

    <Box color="red" />

    <Box color="green" />

    <Box color="blue" />



export default App;

export const Box = (props) => (

  <View style={{ width: 100, height: 100, backgroundColor: props.color }} />