Reputation: 11
You can import file using index.js
naming and pointing to folder where is that file.
- src
App.js
- Component
index.js
And when importing it will fallback to index.js
import Component from './Component'
Can I write the same but remaining file named as folder?
Upvotes: 0
Views: 92
Reputation: 13698
Both React and Solid follows JavaScript's import and export semantics and there are no extra rules or workarounds.
In JavaScript, pointing to a file or folder has no effect, you have to import and export items explicitly and there is no built-in fallback mechanism.
You can learn more about ES6 module rules at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules.
Upvotes: 0