Skip to content
Advertisement

How to filter array of object value and update the values using useState in React JS

I have a array of object

JavaScript

Filter and Update

I am trying to filter the object by values where required === true and value.length === 0

and update the filtered array values like helperText = "Enter the " + label and error = true

JavaScript

Advertisement

Answer

The validate function should be, this will also take care of reverting the error back in case of validity.

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement