score:2
a few things are somehow confusing in your code:
after login:
<button type="submit" onclick={logintodo}>
signin
</button>
function logintodo will be called:
const logintodo = (a) => {
a.preventdefault();
};
the page won't refresh and that's it. you haven't defined anything to happen after that.
in signup
you call register function, inside, it dispatches this action:
dispatch(
logintodo({
email: userauth.user.mail,
uid: userauth.user.uid,
displayname: name,
photourl: profile,
})
logintodo, as you defined just prevents page from refresh, it has nothing to do with your dispatch and actions. (also this is where the error comes from)
dispatch takes an object as argument, which usually has two properties: type and payload.
const action={
type:"registeruser" // the type depends on how you designed your reducer.
payload:userdata // email, name, ...
}
dispatch(action)
sometimes people define actioncreators, that has the type itself, and only takes the payload:
const registeractioncreator=(payload)=>({type:"registeruser",payload:payload})
so alternatively you can use:
dispatch(registeractioncreator(userdata))
Source: stackoverflow.com
Related Query
- TypeError dispatcher.useState is not a function when using React Hooks
- How to fix TypeError is not a function (testing promises with Jest)
- React TypeError this._test is not a function
- How to fix TypeError _interopRequireDefault is not a function in Create React App
- REACT Uncaught TypeError .then is not a function
- webpack-cli TypeError cli.isValidationError is not a function
- There is TypeError (0 , _ColorReducer.color) is not a function error in React + Redux code
- TypeError this.props.addNode is not a function
- TypeError _this2.flipBook.getPageFlip is not a function
- TypeError "styled": symbol is not a function
- Uncaught TypeError rendering <Router> using React Router in ES6: type.toUpperCase is not a function
- React Redux TypeError - is not a function
- TypeError jQuery timepicker is not a function on test
- ReactJS useGesture: typeerror set is not a function
- TypeError (0 , _index.DEC_NUM) is not a function
- react native TypeError (..) is not a function
- 'Save Palette' button gives a TypeError of 'savePalette' is not a function
- React Redux TypeError this.props.setEmailText is not a function
- Getting a typeError in React saying this.props is not a function when child component tries to call passed function
- How to fix React Context's object is not a function - TypeError
- Ionic IonRefresher render TypeError is not a function
- Uncaught typeError : (//some function) not a function
- React JS TypeError - this is not a function
- react-router-bootstrap LinkContainer component fails with a TypeError (0 , _reactRouterDom.withRouter) is not a function
- TypeError is not a function (export function)
- React app compiles successfully and works but after reloading the page in the browser I get a TypeError var.filter is not a function
- TypeError this.getData is not a function
- When using arrayUnion to add element to arrayField in firestore, i get TypeError default.collection is not a function
- React typeerror in axios callback TypeError: this.setState is not a function
- uncaught typeerror INCLUDES is not a function
More Query from same tag
- Image in public folder not loading after deployment
- Passing a full `event` object in Enzyme simulate function
- React render array of objects in cells of Bootstrap grid
- React Bootstrap - DropdownButton not working
- Removing item from cart Redux, React
- How to mock "this" keyword in Jest Unit Testing
- TypeError: Cannot read property 'url' of undefined / React App crashing
- React (Redux): Check if action has already been executed (Server Side rendering)
- Print out JSON data in React
- Change the Route without Fetching that routes content
- Question mark before dot in javascript / react
- Nextjs Module not found: Package path Swiper scss
- Why is console.log logging twice in react js?
- Append react component
- Jest.js - Testing if component method has been called (React.js)
- how to update nested array values in immutable way in reactjs
- Can we override scss variables vai react props?Is it possible?
- How to work with FileReader 'synchronously' in react/redux
- useParams() for none route components in ReactJS
- React & Redux - Resetting errors when a page loads
- How do I disable/enable a button based on the return value of a method in React?
- Add additonal class names to custom React component
- why is that the simple use of setState method not working in the componentDidMount() method
- SASS React.js Undefined Variable
- Props returns undefined, but I can see its value in the console
- How to create a condition to not render my Header component in one of my Route
- Can you specify that at least one prop of a set must be provided?
- Don't require props, when using component with HOC
- Reactjs Routing and useParams Hook
- React.js controlled components using nested states