score:0
Accepted answer
you can use some()
useeffect(() => {
categoria &&
setprodutosfiltrados(
produtos.filter((item) =>
object.entries(filtros).every(([key,value],i) =>{
//here the value is an array 'variacoes' so to check colors use filter to get all the elements of 'variacoes' array;
//also assuming that the color you are passing will be available here as item[key]
var allcolors = item.map(i=>i.cor)
return value.some((val)=>allcolors.includes(val.cor))
}
)
)
)
Source: stackoverflow.com
Related Query
- How can I use Promise.all on an array of objects and then reassign them to the relevant key in a new object?
- How to get the last children in a deeply nested array with objects
- How to group arrays of objects by value and add the result to another array with same value at specific key
- How to get value based on key from an array of objects javascript
- How can I compare two arrays of objects and add new key to an objects in the second array
- How do I iterate over an array of objects match a common element from another array and return the key value for "name"
- How to get the id rather than labelKey from typeahead when an array of objects is passed through?
- How to loop through an array of objects and get specific key values in React?
- How to move the objects to the top inside array based on the matched key
- how to get the specific key data from multidimensional array in react?
- How to get value based on key from an array of objects in React
- How get to All values matching the query from mongodoDb at Once from multiple documents having nested array of objects
- How to update the value into a nested array of objects if value for specific key is same?
- Javascript : How to get the key value json format in an array
- How is it possible to reset the same value of a key which appears in a array of objects using setState?
- how to get to the key in an array of objects?
- How do I group objects by key and modify the array the reduce function returns?
- How to get the TextField value when enter key is pressed in React?
- How do I get the key of a value in a Typescript Record
- how to get the key of a selected value from a dropdown in reactjs?
- How to get Current week from given array of objects date in javascript
- Fastest way to sort array of objects on the basis of nested key values
- How do I take an array of objects and reduce it so that data at a repeated object key is combined?
- How to change the current array format to just an array of objects format?
- Get the max value for a date from an array of objects
- How to get the object key it has the value
- How to update the array of objects using onChange handler in React JS?
- How can I filter through an array of objects based on a key in a nested array of objects?
- Array of objects and i want to return true if any key value pair in the object is duplicate
- How to update specific value when the state is an array of objects - React
More Query from same tag
- Remove a div from Material UI's Date Picker
- reactjs material ui custom component onchange error
- Uploading a file using "fetch" in reactJS
- How can I update singular value of Array in React State
- virtual DOM and Real DOM difference in React JS?
- Use effect wait for Data from previous page
- How to use the props to handle changes in RSuite.js component framework?
- Sharing Constant Variables between Node and React
- Antd - is there anyway to change background color of the Card title?
- textContent error in react app when i use animejs for letter animation
- Shouldn't Eslint enforce props fields to be readonly in React?
- How to Set Individual Point Colors in Nivo Scatterplot for React
- How can I mock a component's state for unit testing?
- Image shrinks in responsive view with tailwind
- Form.Control as="select"
- Fetched object is not assigned to React state
- Material-UI Rating returns string instead of number
- React route with persistent drawer
- How can I implement an error-free dynamic in-line style in react with typescript?
- Component props.dispatch doesnt work. React redux
- Creating a React component
- Post data through API with RecoilJS
- How to edit image in ASP.NET Core?
- How to reinitialize the state with react hook when rerender the components
- RelayJS infinite scroll
- How to update specific form field in formik when value changes in redux store?
- React Router passing data from one component to another
- How to let a parent component manage the state of child components in React?
- Boolean value is not getting displayed in the component after parsing the JSON
- React: triggering method inside HOC component