0

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();

1 Answer 1

1

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'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.