Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

absolute path react native

//react native or expo
//1. open package.json
//(change myapp to whatever you want to, it can even be src.)
{
  "name": "myapp"
}
//2. update your tsconfig.json file
{
  "compilerOptions": {
     ...
     "baseUrl": "./",
     "paths": {
        "myapp/*": ["*"]
      },
     ...
  }
}
//3.In your.tsx file
import { MyThing } from 'myapp/MyThing';
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #absolute #path #react #native
ADD COMMENT
Topic
Name
7+6 =