Reputation: 1
I created a common folder outside the multiple react apps and pasted the common jsx component in them. but when I tried to access those common components in each of the react apps, I started to get an error saying that I couldn't import files outside the src/ directory of a react project.
Project Structure
Main Compomnent(folder)
React-app-1
React-app-2
React-app-3
React-app-4
I tried various paths and require, and react-app-rewire but couldn't get it to work. I even tried some ways from this site but no luck.
I tried to import the components as a dependency as well but it didn't work out.
so can any of you guys can help me out with this? Appreciate the help :)
Upvotes: 0
Views: 1326
Reputation: 114
You can not access files that are not in the src folder.
You should create a separate repo for the common component. To access those components there are multiple ways -
Upvotes: 1