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)
Source: stackoverflow.com
Related Query
- ReactJS socket.io Any function defined or called under socket on gives type error not a function
- Function not defined error reactjs
- ReactJS giving inst.render is not a function error
- ReactJS error Failed to compile 'define' is not defined
- Reactjs this.setState is not a function error
- reactjs and Facebook API: Getting error 'FB' is not defined no-undef
- instance.render is not a function error in reactjs
- Function not defined error in React.JS component class
- ReactJS Uncaught ReferenceError function is not defined
- require not defined error on bundled JS reactjs
- <Helmet> reactJs not working under function cause error
- ReactJS error TypeError: Object(...) is not a function
- Type Error : destroy is not a function in Reactjs while call api async function in useEffect hook
- trigger function of onChange event not defined error
- reactjs error - onChange is not a function error
- Function Is Not Defined Error in React
- ReactJS - Uncaught ReferenceError: function is not defined
- Firebase database not a function error in ReactJS application
- reactjs es6 calling function inside other function throws function not defined
- Error : this.state.joblistings.map is not a function in ReactJS
- reactjs - this is not a function error on upgrade
- Reactjs ERROR (Uncaught (in promise) TypeError: loadUser is not a function at SignInFunc.js:31:1)
- getting error map function is not defined
- Getting error that my function is not defined
- Using Array.from in Typescript received function is not defined error
- Uncaught type error is not a function reactjs
- ReactJS Webpack error type.toUpperCase is not a function
- getting error : function is not defined in react
- ReactJS - Call to function from map function, function not defined
- ReactJS throws "map" is not defined Error
More Query from same tag
- build with react-router doesn't show my app ( empty page )
- Semantic React / Button with text on left
- React Testing library: TypeError: Cannot read property 'articles' of undefined
- How do i use props.theme.breakpoints with the makeStyles hooks?
- How to navigate page and pass through props from within a function (React)
- DetailList fabric ui sorting issue React hooks
- React state -> h2 tag won't display updated state, just initial one
- Running test via jest, I get `Unexpected token` in included .jsx files
- Create react app is not working correctly
- Conflict while rendering nested components with React Router 4
- React and Electron, Chaining event handlers
- Material UI AutoComplete not rendering on remote dataSource in React application
- I cannot give the flex feature to the menuItem inside the select element
- How can I access the local storage on page reload in redux store?
- Mock useFetch hook with Jest
- my images are not displaying when I run it in react
- Keep selected files in react state
- Passing data from parent to child using react.State but State reset to initial state
- React Google Login Inline Styling
- update state from child in React
- Using useEffect with React-redux
- ReactJs: Is it possible to render DOM to document by class name?
- Toggle class except if a child is clicked in React
- npm local paths - is it possible to import from a subfolder?
- REACT with ts - checking props is null in tsx.view
- React renders again the same div elements - Reconciliation question
- Redux: Derived data for items in a collection
- Debugging ReactJS Components in AspNet Core
- Order of Provider and Router in React app
- Pushing data to an array in already existing object with axios