score:0
you are passing the errors
state instead of any actual props value. from what i can tell, it seems you should pass the ui
prop to your componentwillreceiveprops
utility.
const signin = ({ classes, ui }) => {
// const { email, password, errors, handlesubmit, handlechange } = usersignin();
...
const [errors, seterrors] = usestate({});
useeffect(() => {
componentwillreceiveprops(ui);
}, [ui]);
...
const componentwillreceiveprops = (uiprop) => {
if (uiprop?.errors) {
seterrors({ errors: uiprop.errors });
}
};
return (
...
)
};
signin.proptypes = {
classes: proptypes.object.isrequired,
signinuseraction: proptypes.func.isrequired,
user: proptypes.func.isrequired,
ui: proptypes.func.isrequired,
};
const mapstatetoprops = (state) => ({
user: state.user,
ui: state.ui,
});
const mapactionstoprops = { signinuseraction };
export default connect(
mapstatetoprops,
mapactionstoprops
)(withstyles(theme.styles)(signin));
Source: stackoverflow.com
Related Query
- Cannot read property '.then' of undefined when testing async action creators with redux and react
- React Redux Cannot read property 'dispatch' of undefined
- react / redux - cannot read property "yyy" of undefined
- Faced TypeError: Cannot read property 'counter' of undefined when using Redux in React
- Cannot read property 'map' of undefined - react , redux
- react TypeError: Cannot read property 'fulfilled' of undefined on Redux tool kit
- React Redux - Uncaught (in promise) TypeError: Cannot read property 'props' of undefined
- React Redux - TypeError: Cannot read property 'props' of undefined
- Avoid cannot read property 'map' of undefined in react redux
- TypeError: Cannot read property of undefined react redux
- React / Redux TypeError: Cannot read property 'Requests' of undefined in component
- TypeError: Cannot read property 'map' of undefined react redux when updating
- React Redux error Unhandled Rejection (TypeError): Cannot read property 'data' of undefined
- React redux Cannot read property 'firstName' of undefined
- React Redux Toolkit: TypeError: Cannot read property 'value' of undefined
- React Redux - Showing Dialog after posting data not working - Unhandled Rejection (TypeError): Cannot read property 'openDialog' of undefined
- React redux - Cannot read property 'state' of undefined
- React & Redux : cannot read property of undefined
- Using React Redux Loading Bar : Cannot read property 'default' of undefined
- React Redux TypeError: Cannot read property 'map' of undefined
- Uncaught TypeError: Cannot read property 'type' of undefined React Router Redux
- React Redux - Uncaught TypeError: Cannot read property 'setState' of undefined
- React redux TypeError: Cannot read property 'id' of undefined
- TypeError: Cannot read property 'map' of undefined in react redux
- React Redux Thunk with callback to another function -- TypeError: Cannot read property 'then' of undefined
- React - uncaught TypeError: Cannot read property 'setState' of undefined
- react router v^4.0.0 Uncaught TypeError: Cannot read property 'location' of undefined
- React with ES7: Uncaught TypeError: Cannot read property 'state' of undefined
- React enzyme testing, Cannot read property 'have' of undefined
- Cannot read property 'history' of undefined (useHistory hook of React Router 5)
More Query from same tag
- REACT - Generate number automaticaly
- i want to be able yo open another url inside my react web app
- error: failed to push some refs to 'https://git.heroku.com/readingcom.git'
- Having a limit to the amount of words shown according to <div> height
- why can i not update my state with my api response? data is an array of objects
- how change background color in different pages
- React JS render component from another component
- syntax highlighting for react code in sublime
- Using class property to set initial state in React
- How to wait for a dispatch happening in one store from another store
- Unit testing React component that includes MathJax
- What makes a React library require preact-compat?
- how to make google bots crawl my react website with dynamic urls and display them in google
- What does <T> in javascript for?
- reactjs this.refs vs document.getElementById
- How to get the Blob image preview in my Uppy Custom setup
- How do I show the return values from a function?
- How to insert (inject?) an existing React app (just a UI without a backend) into a SilverStripe page layout?
- Import module from node_modules (create-react-app)
- ReactJS. Quite slow when rendering and updating a simple list of 1500 <li> elements. I thought VirtualDOM was fast
- default react route conflicts with route with params
- webpack-dev-server --hot vs HotModuleReplacementPlugin()
- Trying to create a control panel (radius, upper percentile...) for deckgl hexagon layer
- How to toggle a radio button in Typescript React?
- React dropzone, how to upload image?
- react native- vector-icons: change the name to simple text
- how can I set value in default react-select
- React-router error - 'Cannot call method 'getRouteAtDepth' of undefined'
- sync React Router’s props with a MobX Store
- How to run nrwl/nx production build of web app on localhost (NextJS)