CapceleaCristian / ReactPhoneStore

Phone Store using ReactJS
0 stars 0 forks source link

Export with index.js #3

Closed strdr4605 closed 5 years ago

strdr4605 commented 5 years ago

components/ folder and any folder for ReactComponent should have a index.js file

export * from './BarSelectionBrands';
export * from './BarSelectionProperties';
export * from './Home';
...

Sadly, you are using default export and this approach may not work for you. I don't like default export :-1:. But if anyway you want to work with default export try:

export { default as BarSelectionBrands  } from './BarSelectionBrands';
export { default as BarSelectionProperties } from './BarSelectionProperties';
export { default as Home } from './Home';
...

read me

In App.js components should be imported:

- import NavigationBar from './components/NavigationBar/NavigationBar';
- import Home from './components/Home/Home';
- import PhonesCatalog from './components/PhonesCatalog/PhonesCatalog';
- import PhoneDetailsSingle from './components/PhonesCatalog/PhoneDetailsSingle/PhoneDetailsSingle';
- import InCart from './components/InCart/InCart';
- import NoMatchPage from './components/NoMatchPage/NoMatch';
+ import { 
+    NavigationBar, 
+    Home, 
+    PhonesCatalog, 
+    PhoneDetailsSingle, 
+    InCart, 
+    NoMatchPage 
+  } from './components';