Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 142460

How can components be import with "import * as {name}" syntax in react native?

$
0
0

In a react-native project, I would prefer to be able to import all my component like I do with types in my reducers.

I want to be able to write: import * as Components from '../components'

so I went to my components folder, created an index.js file, imported all the basic components, and exported them like export const ComponentExample1 = ComponentExample1& export const ComponentExample1 = <ComponentExample/>. I figured there might be some naming related errors and thats what seems to have happened because I get the error:

Error: TransformErro SyntaxError: ......index.js: Identifier "ComponentExample1" has already been declared

All of my basic components are exported intra-component as export default ComponentExample1

How can I change my approach to effect my end desire?


Viewing all articles
Browse latest Browse all 142460

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>