Use `create-index`
See original GitHub issueAdd https://github.com/gajus/create-index and autogenerate index.js
files for each component folder.
@bpierre and I were also discussing what we should do when we need to use “internal” components in more than one place. One idea would be to allow named exports (i.e. export { ... }
) from a component so that internal components could access them, but then to not export them to consumers by only re-exporting the default export from each component.
An example, for better clarity:
// in component.js
const InternalComponent = {}
const Component = {} // requires InternalComponent
export { InternalComponent } // this export would be accessible to components inside the library, in case they wanted to restyle it slightly or reuse it
export default Component // this export would be the only component available to outside consumers of the library
// in index.js
export { default as Component } from "component.js"
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
db.collection.createIndex() — MongoDB Manual
2. Creates indexes on collections. To minimize the impact of building an index on replica sets and sharded clusters, use a ...
Read more >MongoDB - db.collection.CreateIndex() Method - GeeksforGeeks
Using this method we can create different types of indexes like text index, 2dsphere index, 2d index, etc. It takes three parameters first...
Read more >MongoDB Indexing Tutorial – createIndex ... - Guru99
Creating an Index in MongoDB is done by using the “createIndex” method. The following example shows how add index to collection. Let's assume ......
Read more >IDBObjectStore.createIndex() - Web APIs | MDN
The createIndex() method of the IDBObjectStore interface creates and returns a new IDBIndex object in the connected database.
Read more >MongoDB: db.collection.createIndex () method - w3resource
If true, the index only references documents with the specified field. These indexes use less space but behave differently in some situations ( ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No 😊
Agree, we could also only generate the file
src/components/index.js
, and keepsrc/index.js
as a non-generated file to have some control over it:Also, if we strictly follow the rule of one default export per component, we probably don’t even need
create-index
, we could do something like this instead: