Skip to content

Commit

Permalink
Use the App namespace instead of relative imports
Browse files Browse the repository at this point in the history
Adding a `package.json` to the `App` directory allows us to import using the `App` namespace instead of relative paths like `../Containers/Foo`. Relative paths can break when refactoring which is why we prefer absolute paths.
  • Loading branch information
Matthieu Napoli committed Jul 9, 2018
1 parent 27c9f7a commit f4de674
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion App/App.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import {HomeScreen} from "./Containers/HomeScreen";
import {HomeScreen} from "App/Containers/HomeScreen";

export default class App extends Component {
render() {
Expand Down
3 changes: 3 additions & 0 deletions App/package.json
@@ -0,0 +1,3 @@
{
"name": "App"
}
2 changes: 1 addition & 1 deletion index.js
@@ -1,4 +1,4 @@
import { AppRegistry } from 'react-native'
import App from './App/App'
import App from 'App/App'

AppRegistry.registerComponent('Boilerplate', () => App)

0 comments on commit f4de674

Please sign in to comment.