Skip to content

Commit 1f0b00d

Browse files
committed
docs: update local library docs
1 parent 519ea59 commit 1f0b00d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

β€Ždocs/pages/create.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,28 @@ After the project is created, you can find the development workflow in the gener
3131

3232
## Local library
3333

34-
While the default templates are for libraries that are published to npm, you can also create a local library that is not published, but used locally in your app.
34+
While the default templates are for libraries that are published to npm, you can also create a local library that is not published but used locally in your app.
35+
36+
You'd typically use a local library when:
37+
38+
- You're building a native library for your app and don't want to publish it to npm.
39+
- You want to be able to easily copy the library to other projects.
40+
- You're in a monorepo and want to keep the library code in the same repository as the app.
41+
- You're using Expo, but want to use vanilla React Native API for native modules and components.
42+
43+
The structure of the app with a local library may look like this:
44+
45+
```sh
46+
MyApp
47+
β”œβ”€β”€ node_modules
48+
β”œβ”€β”€ modules <-- folder for your local libraries
49+
β”‚ └── awesome-library <-- your local library
50+
β”œβ”€β”€ android
51+
β”œβ”€β”€ ios
52+
β”œβ”€β”€ src
53+
β”œβ”€β”€ index.js
54+
└── package.json
55+
```
3556

3657
If you run `create-react-native-library` in an existing project containing a `package.json`, it'll be automatically detected and you'll be asked if you want to create a local library. You can also pass the `--local` flag to the command to explicitly create a local library:
3758

0 commit comments

Comments
Β (0)