I am having two react applications,
Project A
Project B
Here Project A
is nothing but a simple components application and it contains the only common components.
-> src
-> components
-> Button
This is a very simple button component I have in the Project A
.
Now the requirement is that I am in the need to use this common button component inside any other react applications.
Here in this scenario, I need to use Button component from Project A
inside Project B
.
For which I tried some relative import (I understand it is completely wrong) inside src/App.js
file of Project B
like,
import {Button} from "../../../Project A/src/components
But it gives the error as expected,
Module not found: You attempted to import ../../../Project A/src/components which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
So could anyone help me how to include the button component from Project A
inside Project B
?
Note:
I cannot do copy paste of code and also strictly I need to import it from project
to project
only.
Also both the projects lies under a single folder like,
->Folder
-> Project A
-> Project B