4

I'm very beginner at react-native and I want to create a native module so I followed the official documentation for doing that and in the Native Module Setup but I get confused in the third step where he says "add your newly created module as a dependency in your package.json".

May someon clear that ambiguity and clarify what he means with an example please?

Ahmed Salah
  • 851
  • 2
  • 10
  • 29
  • So `package.json` is a file that contains your npm dependencies. As far as I understand from the link you shared, they are not asking you do publish anything yet. You just have to reference the library you created inside your `package.json` file so that you can use your local library. – lloydaf Nov 26 '18 at 18:27

1 Answers1

2

I solved by following this https://www.deadcoderising.com/how-to-smoothly-develop-node-modules-locally-using-npm-link/

Assuming you used the default names using the official react native documentation and AwesomeProject and MyLibrary are on the same folder level.

  1. navigate inside AwesomeProject
  2. run "npm link ../MyLibrary/"

And then you can proceed to the next step in the documentation, which is to call "npm install"

deggen
  • 60
  • 10