score:1
you can combine the steps of computing each validation step and setting the state into one statement:
validationrules = (param) => {
console.log("password", param);
this.setstate({
charlength: this.islength(param),
lowercase: this.lowercase(param),
uppercase: this.uppercase(param),
number: this.isnumber(param),
});
};
edit: also fyi, return str.length > 2 ? true : false;
can just be shortened to return str.length > 2;
Source: stackoverflow.com
Related Query
- How to check multiple validations for password conditions based onChange event fired in react js
- How can I handle onchange event for multiple select elements from map items
- How to make a page that Filters data on multiple conditions based on user input
- How to do multiple validations for a single value in yup?
- React - how to use hooks to hide or show a component based on an onChange event
- How to handle decimal values in React's onChange event for input?
- How to keep multiple data for check boxes in react using firebase cloud firestore?
- How to move react event handlers to separate file ,export and then import for reuse in multiple different functional components?
- How to sum, divide values of multiple inputs using onChange event | ReactJS
- How to capture the backspace event in onChange tag of Form for Reactjs applications
- how to add multiple onChange in react for single input element
- How to build a proper onChange event for a controlled React component
- How to bind multiple onChange callback for different inputs?
- Why does my onChange event for input change multiple state values in an object array?
- Jest how to wait for mock to be called based on simulate event
- How to add multiple event listeners for the same react component?
- How to reuse a function for multiple select options that only use a single event handler in React
- How to sum values of multiple inputs using onChange event | ReactJS
- How to combine onChange event for basic Validation Form in reactjs
- How to mock multiple promise .then in react hooks and check for state set in one .then
- How to write validations for email and password using react hooks
- how to write unit test for multiple conditions in redux-thunk?
- How can I correctly pass an onChange event to multiple input checkboxes in Reactjs?
- How to Use One handleChange Event for Multiple TextFields?
- How to Update JSON Object's state for onChange event in REACT JS?
- how to write a onchange event for a returned component
- How to trigger the onChange event in React after user stops typing for a specified time
- How can I check multiple conditions inside of UseMemo()
- How to add check in array based on some conditions around a particular element?
- How to validate multiple conditions for one field in Yup?
More Query from same tag
- Hook not reading e.target.name(React)
- How do I give React methods to the onClick handler of an html component?
- disable scrolling on specific page
- How to use TypeScript generics with React render props
- Antd Pro Table remove default search buttons and Implement Debounce
- How to set backgroundImage from input file?
- Do we use Redux for all state updates?
- async/await for fetching data with spinner
- Alternative to mapping over the same array twice for two components?
- How to pass initial values to the FieldArray component in redux form?
- React jQuery does not recognize element as Bootstrap modal
- Validation is not working for these and unable to write something in the forum
- I cant use bootstrap modals in a map function
- Print automatically the JSON Keys only instead of its values Using React
- Cannot load font awesome with webpack
- how to change the center of the map container react-leaflet?
- How can I render <Card.Text> as <div> element and not as <p>?
- The best way to modify react state property with React Hooks
- "Invalid hook call. Hooks can only be called inside of the body of a function component" problem
- Refs return as null
- ReferenceError: module is not defined
- How to implement a toggle effect with react js?
- How to efficiently pass props in nested components?
- Dynamically changing the 'fill' level of an SVG in react
- Apply the .map method to an array of objects
- Multiple level nested routing does not work in react app
- How to override select all action? material-table
- Scrollcontainer with fixed element inside not scrollable on fixed element
- NPM module throws an error when being imported
- 401 Unauthorized on unprotected resource