score:1

Accepted answer

what you need to do is import the function from action file in your component like

import {addinput} from './path/to/action'

and i am assuming your usiong redux, you can bind the action to props with connect and bindactioncreators function

import {connect} from 'react-redux'
import {bindactioncreators} from 'redux'

...

class mycomponentname extends react.component{

  handleclick = (e) => {
        this.props.addinput({input1:this.refs.inp1.value,input2:this.refs.inp2.value}) 

      }
}

function mapdispatchtoprops(dispatch){
     return bindactioncreators({addinput}, dispatch)
}
export default connect(null, mapdispatchtoprops)(mycomponentname)

Related Query

More Query from same tag