I have so many react-native projects and most of them required the same logic in many parts of the app. like the same hooks, same util functions, and identical components.
I am copying and pasting all the code to other projects. Ya I know that's a bad approach. If I change some code in some hooks then I have to update all the projects with it. and that's very bug prone
I don't know much yet about how to solve this problem, but I did some search and I found that
- I can try to create a JS library and a git submodule, and use them in all projects.
- build JS library and publish it to npm.
I am not sure how react-native would work for both of these approaches.
Will I need to create react native module? or do something else? If you have some resources to read please attach some as I couldn't find much on google.