The error is self-explanatory as it is. The error "Only one default export allowed per module" occurs on React when exporting more than one function as default. Here is an example of the code that would throw this error.
As you can see, there are two functions with "export default" keywords in front of the function definition.
You can export a function in two ways, "default" export and "named" export.
Importing a default exported function is as easy as importing the file itself. You can also import the function with any name you like. See the example below:
In "named imports", the importing function name should be exactly in its definition. Named imports are wrapped in curly braces to distinguish from default imports.
In real-world projects, it is a common practice to use "named exports" through out the project to make effecient use of the ediotrs auto import feature as well as to maintain consistency acrross the codebase.
The error "Only one default export allowed per module" occurred because of the existence of multiple default exports. The above examples gave an idea of how you can import "default export" and "named export" functions in a React project.
Thank you for reading, please visit my home page to see more articles which might interest you.