0

I have a react js app and i need to make 2 exports. The first is

export  default reduxForm({
  form: 'simple'  // a unique identifier for this form
})(SimpleForm)

to handle form submission and the next is to bind some ui actions

export default connect(mapStateToProps, bindAction)(Inbox);

When i have the two exports, i get the error that i cant have 2 exports in one module. Can the problem be solved by combining the two exports?.

2 Answers2

0

You can have more than one exports. When you want to export only single function/class/const etc, you should use default export. For multiple exports use exports only.

export reduxForm() 
export connect()

of course, you have to add codes with them :p and just import { reduxForm, connect } from 'path'

0

You need to remove default keywords on both reduxForm() and connect() classes, as per code below:

export reduxForm({
  form: 'simple'  // a unique identifier for this form
})(SimpleForm)

export connect(mapStateToProps, bindAction)(Inbox);

default keywords is only use when you want to export ONE class.

Jerry Chong
  • 7,954
  • 4
  • 45
  • 40