Reputation: 864
Good day, I'm using react native. I need to use two exports in a folder, but I get this error when using it. What is the problem?
import history from "./components/usrFirst";
import { withRouter } from "react-router-dom";
class LoginForm extends Component {
...
}
export default withRouter(LoginForm);
export default !firebase.apps.length ? firebase.initializeApp(config) : firebase.app();
Upvotes: 0
Views: 1327
Reputation: 8784
As the error states, you can't have multiple default
exports. You can have one, and then used a named export for the other.
const FirebaseComponent = !firebase.apps.length ? firebase.initializeApp(config) : firebase.app();
export {
FirebaseComponent
}
export default withRouter(LoginForm)
Then you would use it like so
import LoginForm, { FirebaseComponent } from 'foo.js'
Upvotes: 1