'How to resolve Maximum update depth exceeded. This can happen when a component repeatedly calls setState stateless component

Hi im trying to set the filter value in function level state im getting the below error.

Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.

also attaching the js image

enter image description here

I'm using AutoComple in MUI where I'm using inbuild filter method. I want to get the filtered array out of AutoComplete so I used state to set the value. but I'm getting maximum update depth exceeded. Please any one help me on this I'm new to React.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source